From b8bb67bdfa5c58a978f0fc18f0909380a971772b Mon Sep 17 00:00:00 2001 From: Manish Singh Date: Mon, 21 Jun 1999 20:04:04 +0000 Subject: [PATCH] cosmetic change * app/Makefile.am: cosmetic change * app/plug_in.c: reordered #includes to prevent MAX/MIN conflict * app/menus.c: removed the weird translation code in favor of the item factory translation function. This may have broken some .po files.. we'll see. Also, added some more tearoffs and made tearoffs appear automagically when plugins register menu entries. * libgimp/gimpimage.c * libgimp/gimpenums.h: redid the GOrientation enum to match the app. Removed special casing in the handler. * plug-ins/guillotine/guillotine.c: small clean up -Yosh --- ChangeLog | 17 +++ app/Makefile.am | 2 +- app/actions/plug-in-commands.c | 7 +- app/gui/menus.c | 211 ++++++++++++++------------- app/gui/plug-in-commands.c | 7 +- app/gui/plug-in-menus.c | 7 +- app/menus.c | 211 ++++++++++++++------------- app/menus/menus.c | 211 ++++++++++++++------------- app/menus/plug-in-menus.c | 7 +- app/plug-in/gimpplugin-message.c | 7 +- app/plug-in/gimpplugin-progress.c | 7 +- app/plug-in/gimpplugin.c | 7 +- app/plug-in/gimppluginmanager-call.c | 7 +- app/plug-in/gimppluginmanager-run.c | 7 +- app/plug-in/gimppluginmanager.c | 7 +- app/plug-in/gimppluginshm.c | 7 +- app/plug-in/plug-in-def.c | 7 +- app/plug-in/plug-in-message.c | 7 +- app/plug-in/plug-in-params.c | 7 +- app/plug-in/plug-in-progress.c | 7 +- app/plug-in/plug-in-run.c | 7 +- app/plug-in/plug-in-shm.c | 7 +- app/plug-in/plug-in.c | 7 +- app/plug-in/plug-ins.c | 7 +- app/plug_in.c | 7 +- app/widgets/gimpitemfactory.c | 211 ++++++++++++++------------- libgimp/gimpenums.h | 6 +- libgimp/gimpimage.c | 13 +- libgimp/gimpimage_pdb.c | 13 +- plug-ins/common/guillotine.c | 2 +- plug-ins/guillotine/guillotine.c | 2 +- plug-ins/perl/.cvsignore | 3 + 32 files changed, 548 insertions(+), 494 deletions(-) diff --git a/ChangeLog b/ChangeLog index bca6151410..e7d865466d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +Mon Jun 21 12:51:15 PDT 1999 Manish Singh + + * app/Makefile.am: cosmetic change + + * app/plug_in.c: reordered #includes to prevent MAX/MIN conflict + + * app/menus.c: removed the weird translation code in favor of + the item factory translation function. This may have broken some + .po files.. we'll see. Also, added some more tearoffs and made + tearoffs appear automagically when plugins register menu entries. + + * libgimp/gimpimage.c + * libgimp/gimpenums.h: redid the GOrientation enum to match the + app. Removed special casing in the handler. + + * plug-ins/guillotine/guillotine.c: small clean up + 1999-06-21 Tuomas Kuosmanen * app/paths_dialog.c app/channels_dialog.c: changed the button diff --git a/app/Makefile.am b/app/Makefile.am index 5bb0f65cca..042820b94d 100644 --- a/app/Makefile.am +++ b/app/Makefile.am @@ -254,7 +254,7 @@ gimp_SOURCES = \ layer_select.h \ layers_dialog.c \ layers_dialog.h \ - layers_dialogP.h \ + layers_dialogP.h \ lc_dialog.c \ lc_dialog.h \ lc_dialogP.h \ diff --git a/app/actions/plug-in-commands.c b/app/actions/plug-in-commands.c index b62c006315..16da232013 100644 --- a/app/actions/plug-in-commands.c +++ b/app/actions/plug-in-commands.c @@ -18,6 +18,10 @@ #include "config.h" +#ifdef HAVE_SYS_PARAM_H +#include +#endif + #include #include @@ -32,9 +36,6 @@ #include #endif #include -#ifdef HAVE_SYS_PARAM_H -#include -#endif #include #include #ifdef HAVE_UNISTD_H diff --git a/app/gui/menus.c b/app/gui/menus.c index 2b0c1ae444..af6c4da11b 100644 --- a/app/gui/menus.c +++ b/app/gui/menus.c @@ -45,13 +45,13 @@ static char* G_GNUC_UNUSED dummyMRU = N_("/File/MRU00 "); -static void menus_init (void); -static GtkItemFactoryEntry * translate_entries (const GtkItemFactoryEntry *, gint); -static void free_translated_entries(GtkItemFactoryEntry *, gint); +static void menus_init (void); +static gchar* menu_translate (const gchar *path, + gpointer data); static GSList *last_opened_raw_filenames = NULL; -static const GtkItemFactoryEntry toolbox_entries[] = +static GtkItemFactoryEntry toolbox_entries[] = { { N_("/File/tearoff1"), NULL, NULL, 0, "" }, { N_("/File/New"), "N", file_new_cmd_callback, 0 }, @@ -77,10 +77,10 @@ static const GtkItemFactoryEntry toolbox_entries[] = static guint n_toolbox_entries = sizeof (toolbox_entries) / sizeof (toolbox_entries[0]); static GtkItemFactory *toolbox_factory = NULL; -static const GtkItemFactoryEntry file_menu_separator = { N_("/File/---"), NULL, NULL, 0, "" }; -static const GtkItemFactoryEntry toolbox_end = { N_("/File/Quit"), "Q", file_quit_cmd_callback, 0 }; +static GtkItemFactoryEntry file_menu_separator = { N_("/File/---"), NULL, NULL, 0, "" }; +static GtkItemFactoryEntry toolbox_end = { N_("/File/Quit"), "Q", file_quit_cmd_callback, 0 }; -static const GtkItemFactoryEntry image_entries[] = +static GtkItemFactoryEntry image_entries[] = { { N_("/tearoff1"), NULL, NULL, 0, "" }, { N_("/File/tearoff1"), NULL, NULL, 0, "" }, @@ -148,12 +148,15 @@ static const GtkItemFactoryEntry image_entries[] = { N_("/View/Shrink Wrap"), "E", view_shrink_wrap_cmd_callback, 0 }, { N_("/Image/tearoff1"), NULL, NULL, 0, "" }, + { N_("/Image/Colors/tearoff1"), NULL, NULL, 0, "" }, { N_("/Image/Colors/Equalize"), NULL, image_equalize_cmd_callback, 0 }, { N_("/Image/Colors/Invert"), NULL, image_invert_cmd_callback, 0 }, { N_("/Image/Colors/---"), NULL, NULL, 0, "" }, { N_("/Image/Colors/Desaturate"), NULL, image_desaturate_cmd_callback, 0 }, + { N_("/Image/Channel Ops/tearoff1"), NULL, NULL, 0, "" }, { N_("/Image/Channel Ops/Duplicate"), "D", channel_ops_duplicate_cmd_callback, 0 }, { N_("/Image/Channel Ops/Offset"), "O", channel_ops_offset_cmd_callback, 0 }, + { N_("/Image/Alpha/tearoff1"), NULL, NULL, 0, "" }, { N_("/Image/Alpha/Add Alpha Channel"), NULL, layers_add_alpha_channel_cmd_callback, 0 }, { N_("/Image/---"), NULL, NULL, 0, "" }, @@ -167,6 +170,7 @@ static const GtkItemFactoryEntry image_entries[] = { N_("/Layers/tearoff1"), NULL, NULL, 0, "" }, { N_("/Layers/Layers & Channels..."), "L", dialogs_lc_cmd_callback, 0 }, + { N_("/Layers/Stack/tearoff1"), NULL, NULL, 0, "" }, { N_("/Layers/Stack/Previous Layer"), "Prior", layers_previous_cmd_callback, 0 }, { N_("/Layers/Stack/Next Layer"), "Next", layers_next_cmd_callback, 0 }, { N_("/Layers/Stack/Raise Layer"), "Prior", layers_raise_cmd_callback, 0 }, @@ -241,7 +245,7 @@ static const GtkItemFactoryEntry image_entries[] = static guint n_image_entries = sizeof (image_entries) / sizeof (image_entries[0]); static GtkItemFactory *image_factory = NULL; -static const GtkItemFactoryEntry load_entries[] = +static GtkItemFactoryEntry load_entries[] = { { N_("/Automatic"), NULL, file_load_by_extension_callback, 0 }, { "/---", NULL, NULL, 0, "" }, @@ -249,7 +253,7 @@ static const GtkItemFactoryEntry load_entries[] = static guint n_load_entries = sizeof (load_entries) / sizeof (load_entries[0]); static GtkItemFactory *load_factory = NULL; -static const GtkItemFactoryEntry save_entries[] = +static GtkItemFactoryEntry save_entries[] = { { N_("/By extension"), NULL, file_save_by_extension_callback, 0 }, { "/---", NULL, NULL, 0, "" }, @@ -257,7 +261,7 @@ static const GtkItemFactoryEntry save_entries[] = static guint n_save_entries = sizeof (save_entries) / sizeof (save_entries[0]); static GtkItemFactory *save_factory = NULL; -static const GtkItemFactoryEntry layers_entries[] = +static GtkItemFactoryEntry layers_entries[] = { { N_("/New Layer"), "N", layers_dialog_new_layer_callback, 0 }, { N_("/Stack/Previous Layer"), "Prior", layers_dialog_previous_layer_callback, 0 }, @@ -286,7 +290,7 @@ static const GtkItemFactoryEntry layers_entries[] = static guint n_layers_entries = sizeof (layers_entries) / sizeof (layers_entries[0]); static GtkItemFactory *layers_factory = NULL; -static const GtkItemFactoryEntry channels_entries[] = +static GtkItemFactoryEntry channels_entries[] = { { N_("/New Channel"), "N", channels_dialog_new_channel_callback, 0 }, { N_("/Raise Channel"), "F", channels_dialog_raise_channel_callback, 0 }, @@ -302,7 +306,7 @@ static const GtkItemFactoryEntry channels_entries[] = static guint n_channels_entries = sizeof (channels_entries) / sizeof (channels_entries[0]); static GtkItemFactory *channels_factory = NULL; -static const GtkItemFactoryEntry paths_entries[] = +static GtkItemFactoryEntry paths_entries[] = { { N_("/New Path"), "N", paths_dialog_new_path_callback, 0 }, { N_("/Duplicate Path"), "U", paths_dialog_dup_path_callback, 0 }, @@ -417,32 +421,61 @@ void menus_create (GtkMenuEntry *entries, int n_menu_entries) { - GtkItemFactory *ifactory; GtkWidget *menu_item; int i; int redo_image_menu = FALSE; + GString *tearoff_path; if (initialize) menus_init (); - gtk_item_factory_create_menu_entries (n_menu_entries, entries); + tearoff_path = g_string_new (""); for (i = 0; i < n_menu_entries; i++) - if (! strncmp (entries[i].path, "", 7)) - redo_image_menu = TRUE; + if (! strncmp (entries[i].path, "", 7)) + { + char *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"); + + if (! gtk_item_factory_get_widget (image_factory, tearoff_path->str)) + { + GtkItemFactoryEntry entry = { NULL, NULL, NULL, 0, "" }; + entry.path = tearoff_path->str; + gtk_item_factory_create_items (image_factory, 1, &entry, NULL); + } + + p = strchr (p + 1, '/'); + } + + redo_image_menu = TRUE; + } + + g_string_free (tearoff_path, TRUE); + + gtk_item_factory_create_menu_entries (n_menu_entries, entries); if (redo_image_menu) { - ifactory = gtk_item_factory_from_path ("/File/Quit"); - menu_item = gtk_item_factory_get_widget (ifactory, "/File/---moved"); - if (menu_item && menu_item->parent) - gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, -1); - menu_item = gtk_item_factory_get_widget (ifactory, "/File/Close"); - if (menu_item && menu_item->parent) - gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, -1); - menu_item = gtk_item_factory_get_widget (ifactory, "/File/Quit"); - if (menu_item && menu_item->parent) - gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, -1); + menu_item = gtk_item_factory_get_widget (image_factory, + "/File/---moved"); + if (menu_item && menu_item->parent) + gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, -1); + + menu_item = gtk_item_factory_get_widget (image_factory, + "/File/Close"); + if (menu_item && menu_item->parent) + gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, -1); + + menu_item = gtk_item_factory_get_widget (image_factory, + "/File/Quit"); + if (menu_item && menu_item->parent) + gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, -1); } } @@ -451,7 +484,7 @@ menus_tools_create (ToolInfo *tool_info) { GtkItemFactoryEntry entry; - entry.path = gettext(tool_info->menu_path); + entry.path = tool_info->menu_path; entry.accelerator = tool_info->menu_accel; entry.callback = tools_select_cmd_callback; entry.callback_action = tool_info->tool_id; @@ -459,7 +492,7 @@ menus_tools_create (ToolInfo *tool_info) gtk_item_factory_create_item (image_factory, &entry, - (gpointer)tool_info, + (gpointer) tool_info, 2); } @@ -494,9 +527,10 @@ menus_set_sensitive_locale (gchar *prepath, gint sensitive) { gchar *menupath; - menupath=g_strdup_printf("%s%s",prepath,_(path)); - menus_set_sensitive(menupath,sensitive); - g_free(menupath); + + menupath = g_strdup_printf ("%s%s", prepath, _(path)); + menus_set_sensitive (menupath, sensitive); + g_free (menupath); } void @@ -530,9 +564,10 @@ menus_set_state_locale (gchar *prepath, gint state) { gchar *menupath; - menupath=g_strdup_printf("%s%s",prepath,_(path)); - menus_set_state(menupath,state); - g_free(menupath); + + menupath = g_strdup_printf ("%s%s", prepath, _(path)); + menus_set_state (menupath, state); + g_free (menupath); } void @@ -567,16 +602,16 @@ menus_quit (void) } void -menus_last_opened_cmd_callback (GtkWidget *widget, - gpointer callback_data, - guint num) +menus_last_opened_cmd_callback (GtkWidget *widget, + gpointer callback_data, + guint num) { gchar *filename, *raw_filename; raw_filename = ((GString *) g_slist_nth_data (last_opened_raw_filenames, num))->str; filename = g_basename (raw_filename); - if (!file_open(raw_filename, filename)) + if (!file_open (raw_filename, filename)) g_message (_("Error opening file: %s\n"), raw_filename); } @@ -706,61 +741,22 @@ menus_init_mru (void) void menus_init_toolbox (void) { - GtkItemFactoryEntry *translated_entries; - toolbox_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "", NULL); - translated_entries=translate_entries(toolbox_entries, n_toolbox_entries); + gtk_item_factory_set_translate_func (toolbox_factory, menu_translate, + NULL, NULL); gtk_item_factory_create_items_ac (toolbox_factory, n_toolbox_entries, - translated_entries, NULL, 2); - free_translated_entries(translated_entries, n_toolbox_entries); + toolbox_entries, NULL, 2); menus_init_mru (); - translated_entries=translate_entries(&file_menu_separator,1); - gtk_item_factory_create_item (toolbox_factory, translated_entries, NULL, 2); - free_translated_entries(translated_entries, 1); + gtk_item_factory_create_item (toolbox_factory, &file_menu_separator, NULL, 2); - translated_entries=translate_entries(&toolbox_end,1); - gtk_item_factory_create_item (toolbox_factory, translated_entries, NULL, 2); - free_translated_entries(translated_entries, 1); + gtk_item_factory_create_item (toolbox_factory, &toolbox_end, NULL, 2); } -static GtkItemFactoryEntry * -translate_entries (const GtkItemFactoryEntry *entries, gint n) -{ - gint i; - GtkItemFactoryEntry *ret; - - ret = g_malloc (sizeof (GtkItemFactoryEntry) * n); - for (i=0; i", NULL); - translated_entries = translate_entries (image_entries, n_image_entries); + gtk_item_factory_set_translate_func (image_factory, + menu_translate, + NULL, NULL); gtk_item_factory_create_items_ac (image_factory, n_image_entries, - translated_entries, + image_entries, NULL, 2); - free_translated_entries (translated_entries, n_image_entries); load_factory = gtk_item_factory_new (GTK_TYPE_MENU, "", NULL); - translated_entries = translate_entries (load_entries, n_load_entries); + gtk_item_factory_set_translate_func (load_factory, + menu_translate, + NULL, NULL); gtk_item_factory_create_items_ac (load_factory, n_load_entries, - translated_entries, + load_entries, NULL, 2); - free_translated_entries (translated_entries, n_load_entries); save_factory = gtk_item_factory_new (GTK_TYPE_MENU, "", NULL); - translated_entries = translate_entries (load_entries, n_save_entries); + gtk_item_factory_set_translate_func (save_factory, + menu_translate, + NULL, NULL); gtk_item_factory_create_items_ac (save_factory, n_save_entries, - translated_entries, + save_entries, NULL, 2); - free_translated_entries (translated_entries, n_save_entries); layers_factory = gtk_item_factory_new (GTK_TYPE_MENU, "", NULL); - translated_entries = translate_entries (layers_entries, n_layers_entries); + gtk_item_factory_set_translate_func (layers_factory, + menu_translate, + NULL, NULL); gtk_item_factory_create_items_ac (layers_factory, n_layers_entries, - translated_entries, + layers_entries, NULL, 2); - free_translated_entries (translated_entries, n_layers_entries); channels_factory = gtk_item_factory_new (GTK_TYPE_MENU, "", NULL); - translated_entries = translate_entries (channels_entries, n_channels_entries); + gtk_item_factory_set_translate_func (channels_factory, + menu_translate, + NULL, NULL); gtk_item_factory_create_items_ac (channels_factory, n_channels_entries, - translated_entries, + channels_entries, NULL, 2); - free_translated_entries (translated_entries, n_channels_entries); paths_factory = gtk_item_factory_new (GTK_TYPE_MENU, "", NULL); - translated_entries = translate_entries (paths_entries, n_paths_entries); + gtk_item_factory_set_translate_func (paths_factory, + menu_translate, + NULL, NULL); gtk_item_factory_create_items_ac (paths_factory, n_paths_entries, - translated_entries, + paths_entries, NULL, 2); - free_translated_entries (translated_entries, n_paths_entries); for (i = 0; i < num_tools; i++) { @@ -830,3 +832,10 @@ menus_init () g_free (filename); } } + +static gchar * +menu_translate (const gchar *path, + gpointer data) +{ + return gettext (path); +} diff --git a/app/gui/plug-in-commands.c b/app/gui/plug-in-commands.c index b62c006315..16da232013 100644 --- a/app/gui/plug-in-commands.c +++ b/app/gui/plug-in-commands.c @@ -18,6 +18,10 @@ #include "config.h" +#ifdef HAVE_SYS_PARAM_H +#include +#endif + #include #include @@ -32,9 +36,6 @@ #include #endif #include -#ifdef HAVE_SYS_PARAM_H -#include -#endif #include #include #ifdef HAVE_UNISTD_H diff --git a/app/gui/plug-in-menus.c b/app/gui/plug-in-menus.c index b62c006315..16da232013 100644 --- a/app/gui/plug-in-menus.c +++ b/app/gui/plug-in-menus.c @@ -18,6 +18,10 @@ #include "config.h" +#ifdef HAVE_SYS_PARAM_H +#include +#endif + #include #include @@ -32,9 +36,6 @@ #include #endif #include -#ifdef HAVE_SYS_PARAM_H -#include -#endif #include #include #ifdef HAVE_UNISTD_H diff --git a/app/menus.c b/app/menus.c index 2b0c1ae444..af6c4da11b 100644 --- a/app/menus.c +++ b/app/menus.c @@ -45,13 +45,13 @@ static char* G_GNUC_UNUSED dummyMRU = N_("/File/MRU00 "); -static void menus_init (void); -static GtkItemFactoryEntry * translate_entries (const GtkItemFactoryEntry *, gint); -static void free_translated_entries(GtkItemFactoryEntry *, gint); +static void menus_init (void); +static gchar* menu_translate (const gchar *path, + gpointer data); static GSList *last_opened_raw_filenames = NULL; -static const GtkItemFactoryEntry toolbox_entries[] = +static GtkItemFactoryEntry toolbox_entries[] = { { N_("/File/tearoff1"), NULL, NULL, 0, "" }, { N_("/File/New"), "N", file_new_cmd_callback, 0 }, @@ -77,10 +77,10 @@ static const GtkItemFactoryEntry toolbox_entries[] = static guint n_toolbox_entries = sizeof (toolbox_entries) / sizeof (toolbox_entries[0]); static GtkItemFactory *toolbox_factory = NULL; -static const GtkItemFactoryEntry file_menu_separator = { N_("/File/---"), NULL, NULL, 0, "" }; -static const GtkItemFactoryEntry toolbox_end = { N_("/File/Quit"), "Q", file_quit_cmd_callback, 0 }; +static GtkItemFactoryEntry file_menu_separator = { N_("/File/---"), NULL, NULL, 0, "" }; +static GtkItemFactoryEntry toolbox_end = { N_("/File/Quit"), "Q", file_quit_cmd_callback, 0 }; -static const GtkItemFactoryEntry image_entries[] = +static GtkItemFactoryEntry image_entries[] = { { N_("/tearoff1"), NULL, NULL, 0, "" }, { N_("/File/tearoff1"), NULL, NULL, 0, "" }, @@ -148,12 +148,15 @@ static const GtkItemFactoryEntry image_entries[] = { N_("/View/Shrink Wrap"), "E", view_shrink_wrap_cmd_callback, 0 }, { N_("/Image/tearoff1"), NULL, NULL, 0, "" }, + { N_("/Image/Colors/tearoff1"), NULL, NULL, 0, "" }, { N_("/Image/Colors/Equalize"), NULL, image_equalize_cmd_callback, 0 }, { N_("/Image/Colors/Invert"), NULL, image_invert_cmd_callback, 0 }, { N_("/Image/Colors/---"), NULL, NULL, 0, "" }, { N_("/Image/Colors/Desaturate"), NULL, image_desaturate_cmd_callback, 0 }, + { N_("/Image/Channel Ops/tearoff1"), NULL, NULL, 0, "" }, { N_("/Image/Channel Ops/Duplicate"), "D", channel_ops_duplicate_cmd_callback, 0 }, { N_("/Image/Channel Ops/Offset"), "O", channel_ops_offset_cmd_callback, 0 }, + { N_("/Image/Alpha/tearoff1"), NULL, NULL, 0, "" }, { N_("/Image/Alpha/Add Alpha Channel"), NULL, layers_add_alpha_channel_cmd_callback, 0 }, { N_("/Image/---"), NULL, NULL, 0, "" }, @@ -167,6 +170,7 @@ static const GtkItemFactoryEntry image_entries[] = { N_("/Layers/tearoff1"), NULL, NULL, 0, "" }, { N_("/Layers/Layers & Channels..."), "L", dialogs_lc_cmd_callback, 0 }, + { N_("/Layers/Stack/tearoff1"), NULL, NULL, 0, "" }, { N_("/Layers/Stack/Previous Layer"), "Prior", layers_previous_cmd_callback, 0 }, { N_("/Layers/Stack/Next Layer"), "Next", layers_next_cmd_callback, 0 }, { N_("/Layers/Stack/Raise Layer"), "Prior", layers_raise_cmd_callback, 0 }, @@ -241,7 +245,7 @@ static const GtkItemFactoryEntry image_entries[] = static guint n_image_entries = sizeof (image_entries) / sizeof (image_entries[0]); static GtkItemFactory *image_factory = NULL; -static const GtkItemFactoryEntry load_entries[] = +static GtkItemFactoryEntry load_entries[] = { { N_("/Automatic"), NULL, file_load_by_extension_callback, 0 }, { "/---", NULL, NULL, 0, "" }, @@ -249,7 +253,7 @@ static const GtkItemFactoryEntry load_entries[] = static guint n_load_entries = sizeof (load_entries) / sizeof (load_entries[0]); static GtkItemFactory *load_factory = NULL; -static const GtkItemFactoryEntry save_entries[] = +static GtkItemFactoryEntry save_entries[] = { { N_("/By extension"), NULL, file_save_by_extension_callback, 0 }, { "/---", NULL, NULL, 0, "" }, @@ -257,7 +261,7 @@ static const GtkItemFactoryEntry save_entries[] = static guint n_save_entries = sizeof (save_entries) / sizeof (save_entries[0]); static GtkItemFactory *save_factory = NULL; -static const GtkItemFactoryEntry layers_entries[] = +static GtkItemFactoryEntry layers_entries[] = { { N_("/New Layer"), "N", layers_dialog_new_layer_callback, 0 }, { N_("/Stack/Previous Layer"), "Prior", layers_dialog_previous_layer_callback, 0 }, @@ -286,7 +290,7 @@ static const GtkItemFactoryEntry layers_entries[] = static guint n_layers_entries = sizeof (layers_entries) / sizeof (layers_entries[0]); static GtkItemFactory *layers_factory = NULL; -static const GtkItemFactoryEntry channels_entries[] = +static GtkItemFactoryEntry channels_entries[] = { { N_("/New Channel"), "N", channels_dialog_new_channel_callback, 0 }, { N_("/Raise Channel"), "F", channels_dialog_raise_channel_callback, 0 }, @@ -302,7 +306,7 @@ static const GtkItemFactoryEntry channels_entries[] = static guint n_channels_entries = sizeof (channels_entries) / sizeof (channels_entries[0]); static GtkItemFactory *channels_factory = NULL; -static const GtkItemFactoryEntry paths_entries[] = +static GtkItemFactoryEntry paths_entries[] = { { N_("/New Path"), "N", paths_dialog_new_path_callback, 0 }, { N_("/Duplicate Path"), "U", paths_dialog_dup_path_callback, 0 }, @@ -417,32 +421,61 @@ void menus_create (GtkMenuEntry *entries, int n_menu_entries) { - GtkItemFactory *ifactory; GtkWidget *menu_item; int i; int redo_image_menu = FALSE; + GString *tearoff_path; if (initialize) menus_init (); - gtk_item_factory_create_menu_entries (n_menu_entries, entries); + tearoff_path = g_string_new (""); for (i = 0; i < n_menu_entries; i++) - if (! strncmp (entries[i].path, "", 7)) - redo_image_menu = TRUE; + if (! strncmp (entries[i].path, "", 7)) + { + char *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"); + + if (! gtk_item_factory_get_widget (image_factory, tearoff_path->str)) + { + GtkItemFactoryEntry entry = { NULL, NULL, NULL, 0, "" }; + entry.path = tearoff_path->str; + gtk_item_factory_create_items (image_factory, 1, &entry, NULL); + } + + p = strchr (p + 1, '/'); + } + + redo_image_menu = TRUE; + } + + g_string_free (tearoff_path, TRUE); + + gtk_item_factory_create_menu_entries (n_menu_entries, entries); if (redo_image_menu) { - ifactory = gtk_item_factory_from_path ("/File/Quit"); - menu_item = gtk_item_factory_get_widget (ifactory, "/File/---moved"); - if (menu_item && menu_item->parent) - gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, -1); - menu_item = gtk_item_factory_get_widget (ifactory, "/File/Close"); - if (menu_item && menu_item->parent) - gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, -1); - menu_item = gtk_item_factory_get_widget (ifactory, "/File/Quit"); - if (menu_item && menu_item->parent) - gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, -1); + menu_item = gtk_item_factory_get_widget (image_factory, + "/File/---moved"); + if (menu_item && menu_item->parent) + gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, -1); + + menu_item = gtk_item_factory_get_widget (image_factory, + "/File/Close"); + if (menu_item && menu_item->parent) + gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, -1); + + menu_item = gtk_item_factory_get_widget (image_factory, + "/File/Quit"); + if (menu_item && menu_item->parent) + gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, -1); } } @@ -451,7 +484,7 @@ menus_tools_create (ToolInfo *tool_info) { GtkItemFactoryEntry entry; - entry.path = gettext(tool_info->menu_path); + entry.path = tool_info->menu_path; entry.accelerator = tool_info->menu_accel; entry.callback = tools_select_cmd_callback; entry.callback_action = tool_info->tool_id; @@ -459,7 +492,7 @@ menus_tools_create (ToolInfo *tool_info) gtk_item_factory_create_item (image_factory, &entry, - (gpointer)tool_info, + (gpointer) tool_info, 2); } @@ -494,9 +527,10 @@ menus_set_sensitive_locale (gchar *prepath, gint sensitive) { gchar *menupath; - menupath=g_strdup_printf("%s%s",prepath,_(path)); - menus_set_sensitive(menupath,sensitive); - g_free(menupath); + + menupath = g_strdup_printf ("%s%s", prepath, _(path)); + menus_set_sensitive (menupath, sensitive); + g_free (menupath); } void @@ -530,9 +564,10 @@ menus_set_state_locale (gchar *prepath, gint state) { gchar *menupath; - menupath=g_strdup_printf("%s%s",prepath,_(path)); - menus_set_state(menupath,state); - g_free(menupath); + + menupath = g_strdup_printf ("%s%s", prepath, _(path)); + menus_set_state (menupath, state); + g_free (menupath); } void @@ -567,16 +602,16 @@ menus_quit (void) } void -menus_last_opened_cmd_callback (GtkWidget *widget, - gpointer callback_data, - guint num) +menus_last_opened_cmd_callback (GtkWidget *widget, + gpointer callback_data, + guint num) { gchar *filename, *raw_filename; raw_filename = ((GString *) g_slist_nth_data (last_opened_raw_filenames, num))->str; filename = g_basename (raw_filename); - if (!file_open(raw_filename, filename)) + if (!file_open (raw_filename, filename)) g_message (_("Error opening file: %s\n"), raw_filename); } @@ -706,61 +741,22 @@ menus_init_mru (void) void menus_init_toolbox (void) { - GtkItemFactoryEntry *translated_entries; - toolbox_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "", NULL); - translated_entries=translate_entries(toolbox_entries, n_toolbox_entries); + gtk_item_factory_set_translate_func (toolbox_factory, menu_translate, + NULL, NULL); gtk_item_factory_create_items_ac (toolbox_factory, n_toolbox_entries, - translated_entries, NULL, 2); - free_translated_entries(translated_entries, n_toolbox_entries); + toolbox_entries, NULL, 2); menus_init_mru (); - translated_entries=translate_entries(&file_menu_separator,1); - gtk_item_factory_create_item (toolbox_factory, translated_entries, NULL, 2); - free_translated_entries(translated_entries, 1); + gtk_item_factory_create_item (toolbox_factory, &file_menu_separator, NULL, 2); - translated_entries=translate_entries(&toolbox_end,1); - gtk_item_factory_create_item (toolbox_factory, translated_entries, NULL, 2); - free_translated_entries(translated_entries, 1); + gtk_item_factory_create_item (toolbox_factory, &toolbox_end, NULL, 2); } -static GtkItemFactoryEntry * -translate_entries (const GtkItemFactoryEntry *entries, gint n) -{ - gint i; - GtkItemFactoryEntry *ret; - - ret = g_malloc (sizeof (GtkItemFactoryEntry) * n); - for (i=0; i", NULL); - translated_entries = translate_entries (image_entries, n_image_entries); + gtk_item_factory_set_translate_func (image_factory, + menu_translate, + NULL, NULL); gtk_item_factory_create_items_ac (image_factory, n_image_entries, - translated_entries, + image_entries, NULL, 2); - free_translated_entries (translated_entries, n_image_entries); load_factory = gtk_item_factory_new (GTK_TYPE_MENU, "", NULL); - translated_entries = translate_entries (load_entries, n_load_entries); + gtk_item_factory_set_translate_func (load_factory, + menu_translate, + NULL, NULL); gtk_item_factory_create_items_ac (load_factory, n_load_entries, - translated_entries, + load_entries, NULL, 2); - free_translated_entries (translated_entries, n_load_entries); save_factory = gtk_item_factory_new (GTK_TYPE_MENU, "", NULL); - translated_entries = translate_entries (load_entries, n_save_entries); + gtk_item_factory_set_translate_func (save_factory, + menu_translate, + NULL, NULL); gtk_item_factory_create_items_ac (save_factory, n_save_entries, - translated_entries, + save_entries, NULL, 2); - free_translated_entries (translated_entries, n_save_entries); layers_factory = gtk_item_factory_new (GTK_TYPE_MENU, "", NULL); - translated_entries = translate_entries (layers_entries, n_layers_entries); + gtk_item_factory_set_translate_func (layers_factory, + menu_translate, + NULL, NULL); gtk_item_factory_create_items_ac (layers_factory, n_layers_entries, - translated_entries, + layers_entries, NULL, 2); - free_translated_entries (translated_entries, n_layers_entries); channels_factory = gtk_item_factory_new (GTK_TYPE_MENU, "", NULL); - translated_entries = translate_entries (channels_entries, n_channels_entries); + gtk_item_factory_set_translate_func (channels_factory, + menu_translate, + NULL, NULL); gtk_item_factory_create_items_ac (channels_factory, n_channels_entries, - translated_entries, + channels_entries, NULL, 2); - free_translated_entries (translated_entries, n_channels_entries); paths_factory = gtk_item_factory_new (GTK_TYPE_MENU, "", NULL); - translated_entries = translate_entries (paths_entries, n_paths_entries); + gtk_item_factory_set_translate_func (paths_factory, + menu_translate, + NULL, NULL); gtk_item_factory_create_items_ac (paths_factory, n_paths_entries, - translated_entries, + paths_entries, NULL, 2); - free_translated_entries (translated_entries, n_paths_entries); for (i = 0; i < num_tools; i++) { @@ -830,3 +832,10 @@ menus_init () g_free (filename); } } + +static gchar * +menu_translate (const gchar *path, + gpointer data) +{ + return gettext (path); +} diff --git a/app/menus/menus.c b/app/menus/menus.c index 2b0c1ae444..af6c4da11b 100644 --- a/app/menus/menus.c +++ b/app/menus/menus.c @@ -45,13 +45,13 @@ static char* G_GNUC_UNUSED dummyMRU = N_("/File/MRU00 "); -static void menus_init (void); -static GtkItemFactoryEntry * translate_entries (const GtkItemFactoryEntry *, gint); -static void free_translated_entries(GtkItemFactoryEntry *, gint); +static void menus_init (void); +static gchar* menu_translate (const gchar *path, + gpointer data); static GSList *last_opened_raw_filenames = NULL; -static const GtkItemFactoryEntry toolbox_entries[] = +static GtkItemFactoryEntry toolbox_entries[] = { { N_("/File/tearoff1"), NULL, NULL, 0, "" }, { N_("/File/New"), "N", file_new_cmd_callback, 0 }, @@ -77,10 +77,10 @@ static const GtkItemFactoryEntry toolbox_entries[] = static guint n_toolbox_entries = sizeof (toolbox_entries) / sizeof (toolbox_entries[0]); static GtkItemFactory *toolbox_factory = NULL; -static const GtkItemFactoryEntry file_menu_separator = { N_("/File/---"), NULL, NULL, 0, "" }; -static const GtkItemFactoryEntry toolbox_end = { N_("/File/Quit"), "Q", file_quit_cmd_callback, 0 }; +static GtkItemFactoryEntry file_menu_separator = { N_("/File/---"), NULL, NULL, 0, "" }; +static GtkItemFactoryEntry toolbox_end = { N_("/File/Quit"), "Q", file_quit_cmd_callback, 0 }; -static const GtkItemFactoryEntry image_entries[] = +static GtkItemFactoryEntry image_entries[] = { { N_("/tearoff1"), NULL, NULL, 0, "" }, { N_("/File/tearoff1"), NULL, NULL, 0, "" }, @@ -148,12 +148,15 @@ static const GtkItemFactoryEntry image_entries[] = { N_("/View/Shrink Wrap"), "E", view_shrink_wrap_cmd_callback, 0 }, { N_("/Image/tearoff1"), NULL, NULL, 0, "" }, + { N_("/Image/Colors/tearoff1"), NULL, NULL, 0, "" }, { N_("/Image/Colors/Equalize"), NULL, image_equalize_cmd_callback, 0 }, { N_("/Image/Colors/Invert"), NULL, image_invert_cmd_callback, 0 }, { N_("/Image/Colors/---"), NULL, NULL, 0, "" }, { N_("/Image/Colors/Desaturate"), NULL, image_desaturate_cmd_callback, 0 }, + { N_("/Image/Channel Ops/tearoff1"), NULL, NULL, 0, "" }, { N_("/Image/Channel Ops/Duplicate"), "D", channel_ops_duplicate_cmd_callback, 0 }, { N_("/Image/Channel Ops/Offset"), "O", channel_ops_offset_cmd_callback, 0 }, + { N_("/Image/Alpha/tearoff1"), NULL, NULL, 0, "" }, { N_("/Image/Alpha/Add Alpha Channel"), NULL, layers_add_alpha_channel_cmd_callback, 0 }, { N_("/Image/---"), NULL, NULL, 0, "" }, @@ -167,6 +170,7 @@ static const GtkItemFactoryEntry image_entries[] = { N_("/Layers/tearoff1"), NULL, NULL, 0, "" }, { N_("/Layers/Layers & Channels..."), "L", dialogs_lc_cmd_callback, 0 }, + { N_("/Layers/Stack/tearoff1"), NULL, NULL, 0, "" }, { N_("/Layers/Stack/Previous Layer"), "Prior", layers_previous_cmd_callback, 0 }, { N_("/Layers/Stack/Next Layer"), "Next", layers_next_cmd_callback, 0 }, { N_("/Layers/Stack/Raise Layer"), "Prior", layers_raise_cmd_callback, 0 }, @@ -241,7 +245,7 @@ static const GtkItemFactoryEntry image_entries[] = static guint n_image_entries = sizeof (image_entries) / sizeof (image_entries[0]); static GtkItemFactory *image_factory = NULL; -static const GtkItemFactoryEntry load_entries[] = +static GtkItemFactoryEntry load_entries[] = { { N_("/Automatic"), NULL, file_load_by_extension_callback, 0 }, { "/---", NULL, NULL, 0, "" }, @@ -249,7 +253,7 @@ static const GtkItemFactoryEntry load_entries[] = static guint n_load_entries = sizeof (load_entries) / sizeof (load_entries[0]); static GtkItemFactory *load_factory = NULL; -static const GtkItemFactoryEntry save_entries[] = +static GtkItemFactoryEntry save_entries[] = { { N_("/By extension"), NULL, file_save_by_extension_callback, 0 }, { "/---", NULL, NULL, 0, "" }, @@ -257,7 +261,7 @@ static const GtkItemFactoryEntry save_entries[] = static guint n_save_entries = sizeof (save_entries) / sizeof (save_entries[0]); static GtkItemFactory *save_factory = NULL; -static const GtkItemFactoryEntry layers_entries[] = +static GtkItemFactoryEntry layers_entries[] = { { N_("/New Layer"), "N", layers_dialog_new_layer_callback, 0 }, { N_("/Stack/Previous Layer"), "Prior", layers_dialog_previous_layer_callback, 0 }, @@ -286,7 +290,7 @@ static const GtkItemFactoryEntry layers_entries[] = static guint n_layers_entries = sizeof (layers_entries) / sizeof (layers_entries[0]); static GtkItemFactory *layers_factory = NULL; -static const GtkItemFactoryEntry channels_entries[] = +static GtkItemFactoryEntry channels_entries[] = { { N_("/New Channel"), "N", channels_dialog_new_channel_callback, 0 }, { N_("/Raise Channel"), "F", channels_dialog_raise_channel_callback, 0 }, @@ -302,7 +306,7 @@ static const GtkItemFactoryEntry channels_entries[] = static guint n_channels_entries = sizeof (channels_entries) / sizeof (channels_entries[0]); static GtkItemFactory *channels_factory = NULL; -static const GtkItemFactoryEntry paths_entries[] = +static GtkItemFactoryEntry paths_entries[] = { { N_("/New Path"), "N", paths_dialog_new_path_callback, 0 }, { N_("/Duplicate Path"), "U", paths_dialog_dup_path_callback, 0 }, @@ -417,32 +421,61 @@ void menus_create (GtkMenuEntry *entries, int n_menu_entries) { - GtkItemFactory *ifactory; GtkWidget *menu_item; int i; int redo_image_menu = FALSE; + GString *tearoff_path; if (initialize) menus_init (); - gtk_item_factory_create_menu_entries (n_menu_entries, entries); + tearoff_path = g_string_new (""); for (i = 0; i < n_menu_entries; i++) - if (! strncmp (entries[i].path, "", 7)) - redo_image_menu = TRUE; + if (! strncmp (entries[i].path, "", 7)) + { + char *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"); + + if (! gtk_item_factory_get_widget (image_factory, tearoff_path->str)) + { + GtkItemFactoryEntry entry = { NULL, NULL, NULL, 0, "" }; + entry.path = tearoff_path->str; + gtk_item_factory_create_items (image_factory, 1, &entry, NULL); + } + + p = strchr (p + 1, '/'); + } + + redo_image_menu = TRUE; + } + + g_string_free (tearoff_path, TRUE); + + gtk_item_factory_create_menu_entries (n_menu_entries, entries); if (redo_image_menu) { - ifactory = gtk_item_factory_from_path ("/File/Quit"); - menu_item = gtk_item_factory_get_widget (ifactory, "/File/---moved"); - if (menu_item && menu_item->parent) - gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, -1); - menu_item = gtk_item_factory_get_widget (ifactory, "/File/Close"); - if (menu_item && menu_item->parent) - gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, -1); - menu_item = gtk_item_factory_get_widget (ifactory, "/File/Quit"); - if (menu_item && menu_item->parent) - gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, -1); + menu_item = gtk_item_factory_get_widget (image_factory, + "/File/---moved"); + if (menu_item && menu_item->parent) + gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, -1); + + menu_item = gtk_item_factory_get_widget (image_factory, + "/File/Close"); + if (menu_item && menu_item->parent) + gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, -1); + + menu_item = gtk_item_factory_get_widget (image_factory, + "/File/Quit"); + if (menu_item && menu_item->parent) + gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, -1); } } @@ -451,7 +484,7 @@ menus_tools_create (ToolInfo *tool_info) { GtkItemFactoryEntry entry; - entry.path = gettext(tool_info->menu_path); + entry.path = tool_info->menu_path; entry.accelerator = tool_info->menu_accel; entry.callback = tools_select_cmd_callback; entry.callback_action = tool_info->tool_id; @@ -459,7 +492,7 @@ menus_tools_create (ToolInfo *tool_info) gtk_item_factory_create_item (image_factory, &entry, - (gpointer)tool_info, + (gpointer) tool_info, 2); } @@ -494,9 +527,10 @@ menus_set_sensitive_locale (gchar *prepath, gint sensitive) { gchar *menupath; - menupath=g_strdup_printf("%s%s",prepath,_(path)); - menus_set_sensitive(menupath,sensitive); - g_free(menupath); + + menupath = g_strdup_printf ("%s%s", prepath, _(path)); + menus_set_sensitive (menupath, sensitive); + g_free (menupath); } void @@ -530,9 +564,10 @@ menus_set_state_locale (gchar *prepath, gint state) { gchar *menupath; - menupath=g_strdup_printf("%s%s",prepath,_(path)); - menus_set_state(menupath,state); - g_free(menupath); + + menupath = g_strdup_printf ("%s%s", prepath, _(path)); + menus_set_state (menupath, state); + g_free (menupath); } void @@ -567,16 +602,16 @@ menus_quit (void) } void -menus_last_opened_cmd_callback (GtkWidget *widget, - gpointer callback_data, - guint num) +menus_last_opened_cmd_callback (GtkWidget *widget, + gpointer callback_data, + guint num) { gchar *filename, *raw_filename; raw_filename = ((GString *) g_slist_nth_data (last_opened_raw_filenames, num))->str; filename = g_basename (raw_filename); - if (!file_open(raw_filename, filename)) + if (!file_open (raw_filename, filename)) g_message (_("Error opening file: %s\n"), raw_filename); } @@ -706,61 +741,22 @@ menus_init_mru (void) void menus_init_toolbox (void) { - GtkItemFactoryEntry *translated_entries; - toolbox_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "", NULL); - translated_entries=translate_entries(toolbox_entries, n_toolbox_entries); + gtk_item_factory_set_translate_func (toolbox_factory, menu_translate, + NULL, NULL); gtk_item_factory_create_items_ac (toolbox_factory, n_toolbox_entries, - translated_entries, NULL, 2); - free_translated_entries(translated_entries, n_toolbox_entries); + toolbox_entries, NULL, 2); menus_init_mru (); - translated_entries=translate_entries(&file_menu_separator,1); - gtk_item_factory_create_item (toolbox_factory, translated_entries, NULL, 2); - free_translated_entries(translated_entries, 1); + gtk_item_factory_create_item (toolbox_factory, &file_menu_separator, NULL, 2); - translated_entries=translate_entries(&toolbox_end,1); - gtk_item_factory_create_item (toolbox_factory, translated_entries, NULL, 2); - free_translated_entries(translated_entries, 1); + gtk_item_factory_create_item (toolbox_factory, &toolbox_end, NULL, 2); } -static GtkItemFactoryEntry * -translate_entries (const GtkItemFactoryEntry *entries, gint n) -{ - gint i; - GtkItemFactoryEntry *ret; - - ret = g_malloc (sizeof (GtkItemFactoryEntry) * n); - for (i=0; i", NULL); - translated_entries = translate_entries (image_entries, n_image_entries); + gtk_item_factory_set_translate_func (image_factory, + menu_translate, + NULL, NULL); gtk_item_factory_create_items_ac (image_factory, n_image_entries, - translated_entries, + image_entries, NULL, 2); - free_translated_entries (translated_entries, n_image_entries); load_factory = gtk_item_factory_new (GTK_TYPE_MENU, "", NULL); - translated_entries = translate_entries (load_entries, n_load_entries); + gtk_item_factory_set_translate_func (load_factory, + menu_translate, + NULL, NULL); gtk_item_factory_create_items_ac (load_factory, n_load_entries, - translated_entries, + load_entries, NULL, 2); - free_translated_entries (translated_entries, n_load_entries); save_factory = gtk_item_factory_new (GTK_TYPE_MENU, "", NULL); - translated_entries = translate_entries (load_entries, n_save_entries); + gtk_item_factory_set_translate_func (save_factory, + menu_translate, + NULL, NULL); gtk_item_factory_create_items_ac (save_factory, n_save_entries, - translated_entries, + save_entries, NULL, 2); - free_translated_entries (translated_entries, n_save_entries); layers_factory = gtk_item_factory_new (GTK_TYPE_MENU, "", NULL); - translated_entries = translate_entries (layers_entries, n_layers_entries); + gtk_item_factory_set_translate_func (layers_factory, + menu_translate, + NULL, NULL); gtk_item_factory_create_items_ac (layers_factory, n_layers_entries, - translated_entries, + layers_entries, NULL, 2); - free_translated_entries (translated_entries, n_layers_entries); channels_factory = gtk_item_factory_new (GTK_TYPE_MENU, "", NULL); - translated_entries = translate_entries (channels_entries, n_channels_entries); + gtk_item_factory_set_translate_func (channels_factory, + menu_translate, + NULL, NULL); gtk_item_factory_create_items_ac (channels_factory, n_channels_entries, - translated_entries, + channels_entries, NULL, 2); - free_translated_entries (translated_entries, n_channels_entries); paths_factory = gtk_item_factory_new (GTK_TYPE_MENU, "", NULL); - translated_entries = translate_entries (paths_entries, n_paths_entries); + gtk_item_factory_set_translate_func (paths_factory, + menu_translate, + NULL, NULL); gtk_item_factory_create_items_ac (paths_factory, n_paths_entries, - translated_entries, + paths_entries, NULL, 2); - free_translated_entries (translated_entries, n_paths_entries); for (i = 0; i < num_tools; i++) { @@ -830,3 +832,10 @@ menus_init () g_free (filename); } } + +static gchar * +menu_translate (const gchar *path, + gpointer data) +{ + return gettext (path); +} diff --git a/app/menus/plug-in-menus.c b/app/menus/plug-in-menus.c index b62c006315..16da232013 100644 --- a/app/menus/plug-in-menus.c +++ b/app/menus/plug-in-menus.c @@ -18,6 +18,10 @@ #include "config.h" +#ifdef HAVE_SYS_PARAM_H +#include +#endif + #include #include @@ -32,9 +36,6 @@ #include #endif #include -#ifdef HAVE_SYS_PARAM_H -#include -#endif #include #include #ifdef HAVE_UNISTD_H diff --git a/app/plug-in/gimpplugin-message.c b/app/plug-in/gimpplugin-message.c index b62c006315..16da232013 100644 --- a/app/plug-in/gimpplugin-message.c +++ b/app/plug-in/gimpplugin-message.c @@ -18,6 +18,10 @@ #include "config.h" +#ifdef HAVE_SYS_PARAM_H +#include +#endif + #include #include @@ -32,9 +36,6 @@ #include #endif #include -#ifdef HAVE_SYS_PARAM_H -#include -#endif #include #include #ifdef HAVE_UNISTD_H diff --git a/app/plug-in/gimpplugin-progress.c b/app/plug-in/gimpplugin-progress.c index b62c006315..16da232013 100644 --- a/app/plug-in/gimpplugin-progress.c +++ b/app/plug-in/gimpplugin-progress.c @@ -18,6 +18,10 @@ #include "config.h" +#ifdef HAVE_SYS_PARAM_H +#include +#endif + #include #include @@ -32,9 +36,6 @@ #include #endif #include -#ifdef HAVE_SYS_PARAM_H -#include -#endif #include #include #ifdef HAVE_UNISTD_H diff --git a/app/plug-in/gimpplugin.c b/app/plug-in/gimpplugin.c index b62c006315..16da232013 100644 --- a/app/plug-in/gimpplugin.c +++ b/app/plug-in/gimpplugin.c @@ -18,6 +18,10 @@ #include "config.h" +#ifdef HAVE_SYS_PARAM_H +#include +#endif + #include #include @@ -32,9 +36,6 @@ #include #endif #include -#ifdef HAVE_SYS_PARAM_H -#include -#endif #include #include #ifdef HAVE_UNISTD_H diff --git a/app/plug-in/gimppluginmanager-call.c b/app/plug-in/gimppluginmanager-call.c index b62c006315..16da232013 100644 --- a/app/plug-in/gimppluginmanager-call.c +++ b/app/plug-in/gimppluginmanager-call.c @@ -18,6 +18,10 @@ #include "config.h" +#ifdef HAVE_SYS_PARAM_H +#include +#endif + #include #include @@ -32,9 +36,6 @@ #include #endif #include -#ifdef HAVE_SYS_PARAM_H -#include -#endif #include #include #ifdef HAVE_UNISTD_H diff --git a/app/plug-in/gimppluginmanager-run.c b/app/plug-in/gimppluginmanager-run.c index b62c006315..16da232013 100644 --- a/app/plug-in/gimppluginmanager-run.c +++ b/app/plug-in/gimppluginmanager-run.c @@ -18,6 +18,10 @@ #include "config.h" +#ifdef HAVE_SYS_PARAM_H +#include +#endif + #include #include @@ -32,9 +36,6 @@ #include #endif #include -#ifdef HAVE_SYS_PARAM_H -#include -#endif #include #include #ifdef HAVE_UNISTD_H diff --git a/app/plug-in/gimppluginmanager.c b/app/plug-in/gimppluginmanager.c index b62c006315..16da232013 100644 --- a/app/plug-in/gimppluginmanager.c +++ b/app/plug-in/gimppluginmanager.c @@ -18,6 +18,10 @@ #include "config.h" +#ifdef HAVE_SYS_PARAM_H +#include +#endif + #include #include @@ -32,9 +36,6 @@ #include #endif #include -#ifdef HAVE_SYS_PARAM_H -#include -#endif #include #include #ifdef HAVE_UNISTD_H diff --git a/app/plug-in/gimppluginshm.c b/app/plug-in/gimppluginshm.c index b62c006315..16da232013 100644 --- a/app/plug-in/gimppluginshm.c +++ b/app/plug-in/gimppluginshm.c @@ -18,6 +18,10 @@ #include "config.h" +#ifdef HAVE_SYS_PARAM_H +#include +#endif + #include #include @@ -32,9 +36,6 @@ #include #endif #include -#ifdef HAVE_SYS_PARAM_H -#include -#endif #include #include #ifdef HAVE_UNISTD_H diff --git a/app/plug-in/plug-in-def.c b/app/plug-in/plug-in-def.c index b62c006315..16da232013 100644 --- a/app/plug-in/plug-in-def.c +++ b/app/plug-in/plug-in-def.c @@ -18,6 +18,10 @@ #include "config.h" +#ifdef HAVE_SYS_PARAM_H +#include +#endif + #include #include @@ -32,9 +36,6 @@ #include #endif #include -#ifdef HAVE_SYS_PARAM_H -#include -#endif #include #include #ifdef HAVE_UNISTD_H diff --git a/app/plug-in/plug-in-message.c b/app/plug-in/plug-in-message.c index b62c006315..16da232013 100644 --- a/app/plug-in/plug-in-message.c +++ b/app/plug-in/plug-in-message.c @@ -18,6 +18,10 @@ #include "config.h" +#ifdef HAVE_SYS_PARAM_H +#include +#endif + #include #include @@ -32,9 +36,6 @@ #include #endif #include -#ifdef HAVE_SYS_PARAM_H -#include -#endif #include #include #ifdef HAVE_UNISTD_H diff --git a/app/plug-in/plug-in-params.c b/app/plug-in/plug-in-params.c index b62c006315..16da232013 100644 --- a/app/plug-in/plug-in-params.c +++ b/app/plug-in/plug-in-params.c @@ -18,6 +18,10 @@ #include "config.h" +#ifdef HAVE_SYS_PARAM_H +#include +#endif + #include #include @@ -32,9 +36,6 @@ #include #endif #include -#ifdef HAVE_SYS_PARAM_H -#include -#endif #include #include #ifdef HAVE_UNISTD_H diff --git a/app/plug-in/plug-in-progress.c b/app/plug-in/plug-in-progress.c index b62c006315..16da232013 100644 --- a/app/plug-in/plug-in-progress.c +++ b/app/plug-in/plug-in-progress.c @@ -18,6 +18,10 @@ #include "config.h" +#ifdef HAVE_SYS_PARAM_H +#include +#endif + #include #include @@ -32,9 +36,6 @@ #include #endif #include -#ifdef HAVE_SYS_PARAM_H -#include -#endif #include #include #ifdef HAVE_UNISTD_H diff --git a/app/plug-in/plug-in-run.c b/app/plug-in/plug-in-run.c index b62c006315..16da232013 100644 --- a/app/plug-in/plug-in-run.c +++ b/app/plug-in/plug-in-run.c @@ -18,6 +18,10 @@ #include "config.h" +#ifdef HAVE_SYS_PARAM_H +#include +#endif + #include #include @@ -32,9 +36,6 @@ #include #endif #include -#ifdef HAVE_SYS_PARAM_H -#include -#endif #include #include #ifdef HAVE_UNISTD_H diff --git a/app/plug-in/plug-in-shm.c b/app/plug-in/plug-in-shm.c index b62c006315..16da232013 100644 --- a/app/plug-in/plug-in-shm.c +++ b/app/plug-in/plug-in-shm.c @@ -18,6 +18,10 @@ #include "config.h" +#ifdef HAVE_SYS_PARAM_H +#include +#endif + #include #include @@ -32,9 +36,6 @@ #include #endif #include -#ifdef HAVE_SYS_PARAM_H -#include -#endif #include #include #ifdef HAVE_UNISTD_H diff --git a/app/plug-in/plug-in.c b/app/plug-in/plug-in.c index b62c006315..16da232013 100644 --- a/app/plug-in/plug-in.c +++ b/app/plug-in/plug-in.c @@ -18,6 +18,10 @@ #include "config.h" +#ifdef HAVE_SYS_PARAM_H +#include +#endif + #include #include @@ -32,9 +36,6 @@ #include #endif #include -#ifdef HAVE_SYS_PARAM_H -#include -#endif #include #include #ifdef HAVE_UNISTD_H diff --git a/app/plug-in/plug-ins.c b/app/plug-in/plug-ins.c index b62c006315..16da232013 100644 --- a/app/plug-in/plug-ins.c +++ b/app/plug-in/plug-ins.c @@ -18,6 +18,10 @@ #include "config.h" +#ifdef HAVE_SYS_PARAM_H +#include +#endif + #include #include @@ -32,9 +36,6 @@ #include #endif #include -#ifdef HAVE_SYS_PARAM_H -#include -#endif #include #include #ifdef HAVE_UNISTD_H diff --git a/app/plug_in.c b/app/plug_in.c index b62c006315..16da232013 100644 --- a/app/plug_in.c +++ b/app/plug_in.c @@ -18,6 +18,10 @@ #include "config.h" +#ifdef HAVE_SYS_PARAM_H +#include +#endif + #include #include @@ -32,9 +36,6 @@ #include #endif #include -#ifdef HAVE_SYS_PARAM_H -#include -#endif #include #include #ifdef HAVE_UNISTD_H diff --git a/app/widgets/gimpitemfactory.c b/app/widgets/gimpitemfactory.c index 2b0c1ae444..af6c4da11b 100644 --- a/app/widgets/gimpitemfactory.c +++ b/app/widgets/gimpitemfactory.c @@ -45,13 +45,13 @@ static char* G_GNUC_UNUSED dummyMRU = N_("/File/MRU00 "); -static void menus_init (void); -static GtkItemFactoryEntry * translate_entries (const GtkItemFactoryEntry *, gint); -static void free_translated_entries(GtkItemFactoryEntry *, gint); +static void menus_init (void); +static gchar* menu_translate (const gchar *path, + gpointer data); static GSList *last_opened_raw_filenames = NULL; -static const GtkItemFactoryEntry toolbox_entries[] = +static GtkItemFactoryEntry toolbox_entries[] = { { N_("/File/tearoff1"), NULL, NULL, 0, "" }, { N_("/File/New"), "N", file_new_cmd_callback, 0 }, @@ -77,10 +77,10 @@ static const GtkItemFactoryEntry toolbox_entries[] = static guint n_toolbox_entries = sizeof (toolbox_entries) / sizeof (toolbox_entries[0]); static GtkItemFactory *toolbox_factory = NULL; -static const GtkItemFactoryEntry file_menu_separator = { N_("/File/---"), NULL, NULL, 0, "" }; -static const GtkItemFactoryEntry toolbox_end = { N_("/File/Quit"), "Q", file_quit_cmd_callback, 0 }; +static GtkItemFactoryEntry file_menu_separator = { N_("/File/---"), NULL, NULL, 0, "" }; +static GtkItemFactoryEntry toolbox_end = { N_("/File/Quit"), "Q", file_quit_cmd_callback, 0 }; -static const GtkItemFactoryEntry image_entries[] = +static GtkItemFactoryEntry image_entries[] = { { N_("/tearoff1"), NULL, NULL, 0, "" }, { N_("/File/tearoff1"), NULL, NULL, 0, "" }, @@ -148,12 +148,15 @@ static const GtkItemFactoryEntry image_entries[] = { N_("/View/Shrink Wrap"), "E", view_shrink_wrap_cmd_callback, 0 }, { N_("/Image/tearoff1"), NULL, NULL, 0, "" }, + { N_("/Image/Colors/tearoff1"), NULL, NULL, 0, "" }, { N_("/Image/Colors/Equalize"), NULL, image_equalize_cmd_callback, 0 }, { N_("/Image/Colors/Invert"), NULL, image_invert_cmd_callback, 0 }, { N_("/Image/Colors/---"), NULL, NULL, 0, "" }, { N_("/Image/Colors/Desaturate"), NULL, image_desaturate_cmd_callback, 0 }, + { N_("/Image/Channel Ops/tearoff1"), NULL, NULL, 0, "" }, { N_("/Image/Channel Ops/Duplicate"), "D", channel_ops_duplicate_cmd_callback, 0 }, { N_("/Image/Channel Ops/Offset"), "O", channel_ops_offset_cmd_callback, 0 }, + { N_("/Image/Alpha/tearoff1"), NULL, NULL, 0, "" }, { N_("/Image/Alpha/Add Alpha Channel"), NULL, layers_add_alpha_channel_cmd_callback, 0 }, { N_("/Image/---"), NULL, NULL, 0, "" }, @@ -167,6 +170,7 @@ static const GtkItemFactoryEntry image_entries[] = { N_("/Layers/tearoff1"), NULL, NULL, 0, "" }, { N_("/Layers/Layers & Channels..."), "L", dialogs_lc_cmd_callback, 0 }, + { N_("/Layers/Stack/tearoff1"), NULL, NULL, 0, "" }, { N_("/Layers/Stack/Previous Layer"), "Prior", layers_previous_cmd_callback, 0 }, { N_("/Layers/Stack/Next Layer"), "Next", layers_next_cmd_callback, 0 }, { N_("/Layers/Stack/Raise Layer"), "Prior", layers_raise_cmd_callback, 0 }, @@ -241,7 +245,7 @@ static const GtkItemFactoryEntry image_entries[] = static guint n_image_entries = sizeof (image_entries) / sizeof (image_entries[0]); static GtkItemFactory *image_factory = NULL; -static const GtkItemFactoryEntry load_entries[] = +static GtkItemFactoryEntry load_entries[] = { { N_("/Automatic"), NULL, file_load_by_extension_callback, 0 }, { "/---", NULL, NULL, 0, "" }, @@ -249,7 +253,7 @@ static const GtkItemFactoryEntry load_entries[] = static guint n_load_entries = sizeof (load_entries) / sizeof (load_entries[0]); static GtkItemFactory *load_factory = NULL; -static const GtkItemFactoryEntry save_entries[] = +static GtkItemFactoryEntry save_entries[] = { { N_("/By extension"), NULL, file_save_by_extension_callback, 0 }, { "/---", NULL, NULL, 0, "" }, @@ -257,7 +261,7 @@ static const GtkItemFactoryEntry save_entries[] = static guint n_save_entries = sizeof (save_entries) / sizeof (save_entries[0]); static GtkItemFactory *save_factory = NULL; -static const GtkItemFactoryEntry layers_entries[] = +static GtkItemFactoryEntry layers_entries[] = { { N_("/New Layer"), "N", layers_dialog_new_layer_callback, 0 }, { N_("/Stack/Previous Layer"), "Prior", layers_dialog_previous_layer_callback, 0 }, @@ -286,7 +290,7 @@ static const GtkItemFactoryEntry layers_entries[] = static guint n_layers_entries = sizeof (layers_entries) / sizeof (layers_entries[0]); static GtkItemFactory *layers_factory = NULL; -static const GtkItemFactoryEntry channels_entries[] = +static GtkItemFactoryEntry channels_entries[] = { { N_("/New Channel"), "N", channels_dialog_new_channel_callback, 0 }, { N_("/Raise Channel"), "F", channels_dialog_raise_channel_callback, 0 }, @@ -302,7 +306,7 @@ static const GtkItemFactoryEntry channels_entries[] = static guint n_channels_entries = sizeof (channels_entries) / sizeof (channels_entries[0]); static GtkItemFactory *channels_factory = NULL; -static const GtkItemFactoryEntry paths_entries[] = +static GtkItemFactoryEntry paths_entries[] = { { N_("/New Path"), "N", paths_dialog_new_path_callback, 0 }, { N_("/Duplicate Path"), "U", paths_dialog_dup_path_callback, 0 }, @@ -417,32 +421,61 @@ void menus_create (GtkMenuEntry *entries, int n_menu_entries) { - GtkItemFactory *ifactory; GtkWidget *menu_item; int i; int redo_image_menu = FALSE; + GString *tearoff_path; if (initialize) menus_init (); - gtk_item_factory_create_menu_entries (n_menu_entries, entries); + tearoff_path = g_string_new (""); for (i = 0; i < n_menu_entries; i++) - if (! strncmp (entries[i].path, "", 7)) - redo_image_menu = TRUE; + if (! strncmp (entries[i].path, "", 7)) + { + char *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"); + + if (! gtk_item_factory_get_widget (image_factory, tearoff_path->str)) + { + GtkItemFactoryEntry entry = { NULL, NULL, NULL, 0, "" }; + entry.path = tearoff_path->str; + gtk_item_factory_create_items (image_factory, 1, &entry, NULL); + } + + p = strchr (p + 1, '/'); + } + + redo_image_menu = TRUE; + } + + g_string_free (tearoff_path, TRUE); + + gtk_item_factory_create_menu_entries (n_menu_entries, entries); if (redo_image_menu) { - ifactory = gtk_item_factory_from_path ("/File/Quit"); - menu_item = gtk_item_factory_get_widget (ifactory, "/File/---moved"); - if (menu_item && menu_item->parent) - gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, -1); - menu_item = gtk_item_factory_get_widget (ifactory, "/File/Close"); - if (menu_item && menu_item->parent) - gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, -1); - menu_item = gtk_item_factory_get_widget (ifactory, "/File/Quit"); - if (menu_item && menu_item->parent) - gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, -1); + menu_item = gtk_item_factory_get_widget (image_factory, + "/File/---moved"); + if (menu_item && menu_item->parent) + gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, -1); + + menu_item = gtk_item_factory_get_widget (image_factory, + "/File/Close"); + if (menu_item && menu_item->parent) + gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, -1); + + menu_item = gtk_item_factory_get_widget (image_factory, + "/File/Quit"); + if (menu_item && menu_item->parent) + gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, -1); } } @@ -451,7 +484,7 @@ menus_tools_create (ToolInfo *tool_info) { GtkItemFactoryEntry entry; - entry.path = gettext(tool_info->menu_path); + entry.path = tool_info->menu_path; entry.accelerator = tool_info->menu_accel; entry.callback = tools_select_cmd_callback; entry.callback_action = tool_info->tool_id; @@ -459,7 +492,7 @@ menus_tools_create (ToolInfo *tool_info) gtk_item_factory_create_item (image_factory, &entry, - (gpointer)tool_info, + (gpointer) tool_info, 2); } @@ -494,9 +527,10 @@ menus_set_sensitive_locale (gchar *prepath, gint sensitive) { gchar *menupath; - menupath=g_strdup_printf("%s%s",prepath,_(path)); - menus_set_sensitive(menupath,sensitive); - g_free(menupath); + + menupath = g_strdup_printf ("%s%s", prepath, _(path)); + menus_set_sensitive (menupath, sensitive); + g_free (menupath); } void @@ -530,9 +564,10 @@ menus_set_state_locale (gchar *prepath, gint state) { gchar *menupath; - menupath=g_strdup_printf("%s%s",prepath,_(path)); - menus_set_state(menupath,state); - g_free(menupath); + + menupath = g_strdup_printf ("%s%s", prepath, _(path)); + menus_set_state (menupath, state); + g_free (menupath); } void @@ -567,16 +602,16 @@ menus_quit (void) } void -menus_last_opened_cmd_callback (GtkWidget *widget, - gpointer callback_data, - guint num) +menus_last_opened_cmd_callback (GtkWidget *widget, + gpointer callback_data, + guint num) { gchar *filename, *raw_filename; raw_filename = ((GString *) g_slist_nth_data (last_opened_raw_filenames, num))->str; filename = g_basename (raw_filename); - if (!file_open(raw_filename, filename)) + if (!file_open (raw_filename, filename)) g_message (_("Error opening file: %s\n"), raw_filename); } @@ -706,61 +741,22 @@ menus_init_mru (void) void menus_init_toolbox (void) { - GtkItemFactoryEntry *translated_entries; - toolbox_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "", NULL); - translated_entries=translate_entries(toolbox_entries, n_toolbox_entries); + gtk_item_factory_set_translate_func (toolbox_factory, menu_translate, + NULL, NULL); gtk_item_factory_create_items_ac (toolbox_factory, n_toolbox_entries, - translated_entries, NULL, 2); - free_translated_entries(translated_entries, n_toolbox_entries); + toolbox_entries, NULL, 2); menus_init_mru (); - translated_entries=translate_entries(&file_menu_separator,1); - gtk_item_factory_create_item (toolbox_factory, translated_entries, NULL, 2); - free_translated_entries(translated_entries, 1); + gtk_item_factory_create_item (toolbox_factory, &file_menu_separator, NULL, 2); - translated_entries=translate_entries(&toolbox_end,1); - gtk_item_factory_create_item (toolbox_factory, translated_entries, NULL, 2); - free_translated_entries(translated_entries, 1); + gtk_item_factory_create_item (toolbox_factory, &toolbox_end, NULL, 2); } -static GtkItemFactoryEntry * -translate_entries (const GtkItemFactoryEntry *entries, gint n) -{ - gint i; - GtkItemFactoryEntry *ret; - - ret = g_malloc (sizeof (GtkItemFactoryEntry) * n); - for (i=0; i", NULL); - translated_entries = translate_entries (image_entries, n_image_entries); + gtk_item_factory_set_translate_func (image_factory, + menu_translate, + NULL, NULL); gtk_item_factory_create_items_ac (image_factory, n_image_entries, - translated_entries, + image_entries, NULL, 2); - free_translated_entries (translated_entries, n_image_entries); load_factory = gtk_item_factory_new (GTK_TYPE_MENU, "", NULL); - translated_entries = translate_entries (load_entries, n_load_entries); + gtk_item_factory_set_translate_func (load_factory, + menu_translate, + NULL, NULL); gtk_item_factory_create_items_ac (load_factory, n_load_entries, - translated_entries, + load_entries, NULL, 2); - free_translated_entries (translated_entries, n_load_entries); save_factory = gtk_item_factory_new (GTK_TYPE_MENU, "", NULL); - translated_entries = translate_entries (load_entries, n_save_entries); + gtk_item_factory_set_translate_func (save_factory, + menu_translate, + NULL, NULL); gtk_item_factory_create_items_ac (save_factory, n_save_entries, - translated_entries, + save_entries, NULL, 2); - free_translated_entries (translated_entries, n_save_entries); layers_factory = gtk_item_factory_new (GTK_TYPE_MENU, "", NULL); - translated_entries = translate_entries (layers_entries, n_layers_entries); + gtk_item_factory_set_translate_func (layers_factory, + menu_translate, + NULL, NULL); gtk_item_factory_create_items_ac (layers_factory, n_layers_entries, - translated_entries, + layers_entries, NULL, 2); - free_translated_entries (translated_entries, n_layers_entries); channels_factory = gtk_item_factory_new (GTK_TYPE_MENU, "", NULL); - translated_entries = translate_entries (channels_entries, n_channels_entries); + gtk_item_factory_set_translate_func (channels_factory, + menu_translate, + NULL, NULL); gtk_item_factory_create_items_ac (channels_factory, n_channels_entries, - translated_entries, + channels_entries, NULL, 2); - free_translated_entries (translated_entries, n_channels_entries); paths_factory = gtk_item_factory_new (GTK_TYPE_MENU, "", NULL); - translated_entries = translate_entries (paths_entries, n_paths_entries); + gtk_item_factory_set_translate_func (paths_factory, + menu_translate, + NULL, NULL); gtk_item_factory_create_items_ac (paths_factory, n_paths_entries, - translated_entries, + paths_entries, NULL, 2); - free_translated_entries (translated_entries, n_paths_entries); for (i = 0; i < num_tools; i++) { @@ -830,3 +832,10 @@ menus_init () g_free (filename); } } + +static gchar * +menu_translate (const gchar *path, + gpointer data) +{ + return gettext (path); +} diff --git a/libgimp/gimpenums.h b/libgimp/gimpenums.h index db10c10581..053e100f19 100644 --- a/libgimp/gimpenums.h +++ b/libgimp/gimpenums.h @@ -29,9 +29,9 @@ typedef enum typedef enum { - ORIENTATION_UNKNOWN = -1, - ORIENTATION_VERTICAL = 0, - ORIENTATION_HORIZONTAL = 1 + ORIENTATION_UNKNOWN = 0, + ORIENTATION_HORIZONTAL = 1, + ORIENTATION_VERTICAL = 2 } GOrientation; typedef enum diff --git a/libgimp/gimpimage.c b/libgimp/gimpimage.c index 7979f42cba..fb01758fa2 100644 --- a/libgimp/gimpimage.c +++ b/libgimp/gimpimage.c @@ -122,18 +122,7 @@ gimp_image_get_guide_orientation (gint32 image_id, rtn_guide_orientation = ORIENTATION_UNKNOWN; if (return_vals[0].data.d_status == STATUS_SUCCESS) - { - pdb_orientation = return_vals[1].data.d_int32; - switch (pdb_orientation) - { - case 0: - rtn_guide_orientation = ORIENTATION_VERTICAL; - break; - case 1: - rtn_guide_orientation = ORIENTATION_HORIZONTAL; - break; - } - } + rtn_guide_orientation = return_vals[1].data.d_int32; gimp_destroy_params (return_vals, nreturn_vals); diff --git a/libgimp/gimpimage_pdb.c b/libgimp/gimpimage_pdb.c index 7979f42cba..fb01758fa2 100644 --- a/libgimp/gimpimage_pdb.c +++ b/libgimp/gimpimage_pdb.c @@ -122,18 +122,7 @@ gimp_image_get_guide_orientation (gint32 image_id, rtn_guide_orientation = ORIENTATION_UNKNOWN; if (return_vals[0].data.d_status == STATUS_SUCCESS) - { - pdb_orientation = return_vals[1].data.d_int32; - switch (pdb_orientation) - { - case 0: - rtn_guide_orientation = ORIENTATION_VERTICAL; - break; - case 1: - rtn_guide_orientation = ORIENTATION_HORIZONTAL; - break; - } - } + rtn_guide_orientation = return_vals[1].data.d_int32; gimp_destroy_params (return_vals, nreturn_vals); diff --git a/plug-ins/common/guillotine.c b/plug-ins/common/guillotine.c index bfa8c8cc3b..4d8b527012 100644 --- a/plug-ins/common/guillotine.c +++ b/plug-ins/common/guillotine.c @@ -57,7 +57,7 @@ GPlugInInfo PLUG_IN_INFO = MAIN () static void -query () +query (void) { static GParamDef args[] = { diff --git a/plug-ins/guillotine/guillotine.c b/plug-ins/guillotine/guillotine.c index bfa8c8cc3b..4d8b527012 100644 --- a/plug-ins/guillotine/guillotine.c +++ b/plug-ins/guillotine/guillotine.c @@ -57,7 +57,7 @@ GPlugInInfo PLUG_IN_INFO = MAIN () static void -query () +query (void) { static GParamDef args[] = { diff --git a/plug-ins/perl/.cvsignore b/plug-ins/perl/.cvsignore index b65b3baa3e..2db0308c7e 100644 --- a/plug-ins/perl/.cvsignore +++ b/plug-ins/perl/.cvsignore @@ -5,3 +5,6 @@ blib pm_to_blib Gimp.c Gimp.bs +config.log +config.cache +config.h