2006-12-09 13:33:38 -08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2004-04-19 07:54:24 -07:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
|
*
|
2009-01-17 14:28:01 -08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
2004-04-19 07:54:24 -07:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-17 14:28:01 -08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2004-04-19 07:54:24 -07:00
|
|
|
* (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
|
2018-07-11 14:47:19 -07:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2004-04-19 07:54:24 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
2012-03-29 10:19:01 -07:00
|
|
|
#include <gegl.h>
|
2004-04-19 07:54:24 -07:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
|
|
|
|
|
|
|
|
|
#include "actions-types.h"
|
|
|
|
|
|
|
|
|
|
#include "core/gimpcontext.h"
|
|
|
|
|
|
|
|
|
|
#include "widgets/gimpactiongroup.h"
|
|
|
|
|
#include "widgets/gimphelp-ids.h"
|
|
|
|
|
|
2004-05-12 11:36:33 -07:00
|
|
|
#include "actions.h"
|
2004-04-19 07:54:24 -07:00
|
|
|
#include "documents-actions.h"
|
2004-04-20 06:25:55 -07:00
|
|
|
#include "documents-commands.h"
|
2004-04-19 07:54:24 -07:00
|
|
|
|
|
|
|
|
#include "gimp-intl.h"
|
|
|
|
|
|
|
|
|
|
|
2006-04-10 01:06:18 -07:00
|
|
|
static const GimpActionEntry documents_actions[] =
|
2004-04-19 07:54:24 -07:00
|
|
|
{
|
2017-03-05 07:01:59 -08:00
|
|
|
{ "documents-popup", GIMP_ICON_DOCUMENT_OPEN_RECENT,
|
2008-12-03 07:27:42 -08:00
|
|
|
NC_("documents-action", "Documents Menu"), NULL, NULL, NULL,
|
2004-05-02 01:56:07 -07:00
|
|
|
GIMP_HELP_DOCUMENT_DIALOG },
|
2004-04-21 09:10:00 -07:00
|
|
|
|
2017-03-05 07:01:59 -08:00
|
|
|
{ "documents-open", GIMP_ICON_DOCUMENT_OPEN,
|
2014-05-11 13:49:22 -07:00
|
|
|
NC_("documents-action", "_Open Image"), NULL,
|
2008-12-04 02:32:20 -08:00
|
|
|
NC_("documents-action", "Open the selected entry"),
|
2005-01-14 05:30:05 -08:00
|
|
|
G_CALLBACK (documents_open_cmd_callback),
|
2004-04-19 07:54:24 -07:00
|
|
|
GIMP_HELP_DOCUMENT_OPEN },
|
|
|
|
|
|
2008-08-22 01:57:11 -07:00
|
|
|
{ "documents-raise-or-open", NULL,
|
2014-05-11 13:49:22 -07:00
|
|
|
NC_("documents-action", "_Raise or Open Image"), NULL,
|
2008-12-04 02:32:20 -08:00
|
|
|
NC_("documents-action", "Raise window if already open"),
|
2005-01-14 05:30:05 -08:00
|
|
|
G_CALLBACK (documents_raise_or_open_cmd_callback),
|
2004-04-19 07:54:24 -07:00
|
|
|
GIMP_HELP_DOCUMENT_OPEN },
|
|
|
|
|
|
2008-08-22 01:57:11 -07:00
|
|
|
{ "documents-file-open-dialog", NULL,
|
2014-05-11 13:49:22 -07:00
|
|
|
NC_("documents-action", "File Open _Dialog"), NULL,
|
2008-12-04 02:32:20 -08:00
|
|
|
NC_("documents-action", "Open image dialog"),
|
2004-04-19 07:54:24 -07:00
|
|
|
G_CALLBACK (documents_file_open_dialog_cmd_callback),
|
|
|
|
|
GIMP_HELP_DOCUMENT_OPEN },
|
|
|
|
|
|
2017-03-05 07:01:59 -08:00
|
|
|
{ "documents-copy-location", GIMP_ICON_EDIT_COPY,
|
2014-05-11 13:49:22 -07:00
|
|
|
NC_("documents-action", "Copy Image _Location"), NULL,
|
2008-12-04 02:32:20 -08:00
|
|
|
NC_("documents-action", "Copy image location to clipboard"),
|
2005-07-07 14:49:35 -07:00
|
|
|
G_CALLBACK (documents_copy_location_cmd_callback),
|
|
|
|
|
GIMP_HELP_DOCUMENT_COPY_LOCATION },
|
|
|
|
|
|
2017-02-28 10:31:27 -08:00
|
|
|
{ "documents-show-in-file-manager", GIMP_ICON_FILE_MANAGER,
|
2015-02-17 04:05:21 -08:00
|
|
|
NC_("documents-action", "Show in _File Manager"), NULL,
|
2015-02-16 11:29:31 -08:00
|
|
|
NC_("documents-action", "Show image location in the file manager"),
|
|
|
|
|
G_CALLBACK (documents_show_in_file_manager_cmd_callback),
|
|
|
|
|
GIMP_HELP_DOCUMENT_SHOW_IN_FILE_MANAGER },
|
|
|
|
|
|
2017-03-05 07:01:59 -08:00
|
|
|
{ "documents-remove", GIMP_ICON_LIST_REMOVE,
|
2014-05-11 13:49:22 -07:00
|
|
|
NC_("documents-action", "Remove _Entry"), NULL,
|
2008-12-04 02:32:20 -08:00
|
|
|
NC_("documents-action", "Remove the selected entry"),
|
2005-01-14 05:30:05 -08:00
|
|
|
G_CALLBACK (documents_remove_cmd_callback),
|
2004-04-19 07:54:24 -07:00
|
|
|
GIMP_HELP_DOCUMENT_REMOVE },
|
|
|
|
|
|
2017-02-28 10:31:27 -08:00
|
|
|
{ "documents-clear", GIMP_ICON_SHRED,
|
2014-05-11 13:49:22 -07:00
|
|
|
NC_("documents-action", "_Clear History"), NULL,
|
2008-12-04 02:32:20 -08:00
|
|
|
NC_("documents-action", "Clear the entire document history"),
|
2005-06-20 12:28:49 -07:00
|
|
|
G_CALLBACK (documents_clear_cmd_callback),
|
|
|
|
|
GIMP_HELP_DOCUMENT_CLEAR },
|
|
|
|
|
|
2017-03-05 07:01:59 -08:00
|
|
|
{ "documents-recreate-preview", GIMP_ICON_VIEW_REFRESH,
|
2014-05-11 13:49:22 -07:00
|
|
|
NC_("documents-action", "Recreate _Preview"), NULL,
|
2008-12-04 02:32:20 -08:00
|
|
|
NC_("documents-action", "Recreate preview"),
|
2004-04-19 07:54:24 -07:00
|
|
|
G_CALLBACK (documents_recreate_preview_cmd_callback),
|
|
|
|
|
GIMP_HELP_DOCUMENT_REFRESH },
|
|
|
|
|
|
2008-08-22 01:57:11 -07:00
|
|
|
{ "documents-reload-previews", NULL,
|
2014-05-11 13:49:22 -07:00
|
|
|
NC_("documents-action", "Reload _all Previews"), NULL,
|
2008-12-04 02:32:20 -08:00
|
|
|
NC_("documents-action", "Reload all previews"),
|
2004-04-19 07:54:24 -07:00
|
|
|
G_CALLBACK (documents_reload_previews_cmd_callback),
|
|
|
|
|
GIMP_HELP_DOCUMENT_REFRESH },
|
|
|
|
|
|
2008-08-22 01:57:11 -07:00
|
|
|
{ "documents-remove-dangling", NULL,
|
2014-05-11 13:49:22 -07:00
|
|
|
NC_("documents-action", "Remove Dangling E_ntries"), NULL,
|
2008-12-04 02:32:20 -08:00
|
|
|
NC_("documents-action",
|
|
|
|
|
"Remove entries for which the corresponding file is not available"),
|
2005-01-14 05:30:05 -08:00
|
|
|
G_CALLBACK (documents_remove_dangling_cmd_callback),
|
2004-04-19 07:54:24 -07:00
|
|
|
GIMP_HELP_DOCUMENT_REFRESH }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2004-04-27 06:55:26 -07:00
|
|
|
documents_actions_setup (GimpActionGroup *group)
|
2004-04-19 07:54:24 -07:00
|
|
|
{
|
2008-12-03 07:27:42 -08:00
|
|
|
gimp_action_group_add_actions (group, "documents-action",
|
2004-04-19 07:54:24 -07:00
|
|
|
documents_actions,
|
2004-04-27 06:55:26 -07:00
|
|
|
G_N_ELEMENTS (documents_actions));
|
2004-04-19 07:54:24 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
documents_actions_update (GimpActionGroup *group,
|
|
|
|
|
gpointer data)
|
|
|
|
|
{
|
2004-05-12 11:36:33 -07:00
|
|
|
GimpContext *context;
|
|
|
|
|
GimpImagefile *imagefile = NULL;
|
2004-04-19 07:54:24 -07:00
|
|
|
|
2004-05-12 11:36:33 -07:00
|
|
|
context = action_data_get_context (data);
|
2004-04-19 07:54:24 -07:00
|
|
|
|
2004-05-12 11:36:33 -07:00
|
|
|
if (context)
|
|
|
|
|
imagefile = gimp_context_get_imagefile (context);
|
2004-04-19 07:54:24 -07:00
|
|
|
|
|
|
|
|
#define SET_SENSITIVE(action,condition) \
|
|
|
|
|
gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
|
|
|
|
|
|
2015-02-16 11:29:31 -08:00
|
|
|
SET_SENSITIVE ("documents-open", imagefile);
|
|
|
|
|
SET_SENSITIVE ("documents-raise-or-open", imagefile);
|
|
|
|
|
SET_SENSITIVE ("documents-file-open-dialog", TRUE);
|
|
|
|
|
SET_SENSITIVE ("documents-copy-location", imagefile);
|
|
|
|
|
SET_SENSITIVE ("documents-show-in-file-manager", imagefile);
|
|
|
|
|
SET_SENSITIVE ("documents-remove", imagefile);
|
|
|
|
|
SET_SENSITIVE ("documents-clear", TRUE);
|
|
|
|
|
SET_SENSITIVE ("documents-recreate-preview", imagefile);
|
|
|
|
|
SET_SENSITIVE ("documents-reload-previews", imagefile);
|
|
|
|
|
SET_SENSITIVE ("documents-remove-dangling", imagefile);
|
2004-04-19 07:54:24 -07:00
|
|
|
|
|
|
|
|
#undef SET_SENSITIVE
|
|
|
|
|
}
|