documents-menu.c 3.35 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
/* The GIMP -- an image manipulation program
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

#include "config.h"

#include <gtk/gtk.h>

#include "libgimpwidgets/gimpwidgets.h"

#include "gui-types.h"

#include "core/gimpcontext.h"

#include "widgets/gimpcontainereditor.h"
#include "widgets/gimpcontainerview.h"
31
#include "widgets/gimphelp-ids.h"
32 33 34 35 36 37
#include "widgets/gimpitemfactory.h"

#include "documents-commands.h"
#include "documents-menu.h"
#include "menus.h"

38
#include "gimp-intl.h"
39 40 41 42


GimpItemFactoryEntry documents_menu_entries[] =
{
43
  { { N_("/_Open Image"), "",
44 45
      documents_open_document_cmd_callback, 0,
      "<StockItem>", GTK_STOCK_OPEN },
46 47
    NULL,
    GIMP_HELP_DOCUMENT_OPEN, NULL },
48
  { { N_("/_Raise or Open Image"), "",
49 50
      documents_raise_or_open_document_cmd_callback, 0,
      "<StockItem>", GTK_STOCK_OPEN },
51 52
    NULL,
    GIMP_HELP_DOCUMENT_OPEN, NULL },
53
  { { N_("/File Open _Dialog..."), "",
54 55
      documents_file_open_dialog_cmd_callback, 0,
      "<StockItem>", GTK_STOCK_OPEN },
56 57
    NULL,
    GIMP_HELP_DOCUMENT_OPEN, NULL },
58
  { { N_("/Remove _Entry"), NULL,
59 60
      documents_remove_document_cmd_callback, 0,
      "<StockItem>", GTK_STOCK_REMOVE },
61 62
    NULL,
    GIMP_HELP_DOCUMENT_REMOVE, NULL },
63 64 65

  MENU_SEPARATOR ("/---"),

66
  { { N_("/Recreate _Preview"), "",
67 68
      documents_recreate_preview_cmd_callback, 0,
      "<StockItem>", GTK_STOCK_REFRESH },
69 70
    NULL,
    GIMP_HELP_DOCUMENT_REFRESH, NULL },
71
  { { N_("/Reload _all Previews"), "",
72 73
      documents_reload_previews_cmd_callback, 0,
      "<StockItem>", GTK_STOCK_REFRESH },
74 75
    NULL,
    GIMP_HELP_DOCUMENT_REFRESH, NULL },
76
  { { N_("/Remove Dangling E_ntries"), "",
77 78
      documents_delete_dangling_documents_cmd_callback, 0,
      "<StockItem>", GTK_STOCK_REFRESH },
79 80
    NULL,
    GIMP_HELP_DOCUMENT_REFRESH, NULL },
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
};

gint n_documents_menu_entries = G_N_ELEMENTS (documents_menu_entries);


void
documents_menu_update (GtkItemFactory *factory,
                       gpointer        data)
{
  GimpContainerEditor *editor;
  GimpImagefile       *imagefile;

  editor = GIMP_CONTAINER_EDITOR (data);

  imagefile = gimp_context_get_imagefile (editor->view->context);

#define SET_SENSITIVE(menu,condition) \
        gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)

  SET_SENSITIVE ("/Open Image",              imagefile);
  SET_SENSITIVE ("/Raise or Open Image",     imagefile);
  SET_SENSITIVE ("/File Open Dialog...",     TRUE);
  SET_SENSITIVE ("/Remove Entry",            imagefile);
  SET_SENSITIVE ("/Recreate Preview",        imagefile);
  SET_SENSITIVE ("/Reload all Previews",     imagefile);
  SET_SENSITIVE ("/Remove Dangling Entries", imagefile);

#undef SET_SENSITIVE
}