1
/* The GIMP -- an image manipulation program
2
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23
#include "libgimpwidgets/gimpwidgets.h"
25
#include "actions-types.h"
27
#include "core/gimpcontext.h"
28
#include "core/gimpdata.h"
30
#include "widgets/gimpactiongroup.h"
31
#include "widgets/gimphelp-ids.h"
34
#include "data-commands.h"
35
#include "patterns-actions.h"
37
#include "gimp-intl.h"
40
static GimpActionEntry patterns_actions[] =
42
{ "patterns-popup", GIMP_STOCK_PATTERN,
43
N_("Patterns Menu"), NULL, NULL, NULL,
44
GIMP_HELP_PATTERN_DIALOG },
46
{ "patterns-new", GTK_STOCK_NEW,
47
N_("_New Pattern"), "",
49
G_CALLBACK (data_new_data_cmd_callback),
50
GIMP_HELP_PATTERN_NEW },
52
{ "patterns-duplicate", GIMP_STOCK_DUPLICATE,
53
N_("D_uplicate Pattern"), NULL,
54
N_("Duplicate pattern"),
55
G_CALLBACK (data_duplicate_data_cmd_callback),
56
GIMP_HELP_PATTERN_DUPLICATE },
58
{ "patterns-delete", GTK_STOCK_DELETE,
59
N_("_Delete Pattern..."), "",
61
G_CALLBACK (data_delete_data_cmd_callback),
62
GIMP_HELP_PATTERN_DELETE },
64
{ "patterns-refresh", GTK_STOCK_REFRESH,
65
N_("_Refresh Patterns"), "",
66
N_("Refresh patterns"),
67
G_CALLBACK (data_refresh_data_cmd_callback),
68
GIMP_HELP_PATTERN_REFRESH }
71
static GimpStringActionEntry patterns_edit_actions[] =
73
{ "patterns-edit", GIMP_STOCK_EDIT,
74
N_("_Edit Pattern..."), NULL,
76
"gimp-pattern-editor",
77
GIMP_HELP_PATTERN_EDIT }
82
patterns_actions_setup (GimpActionGroup *group)
84
gimp_action_group_add_actions (group,
86
G_N_ELEMENTS (patterns_actions));
88
gimp_action_group_add_string_actions (group,
89
patterns_edit_actions,
90
G_N_ELEMENTS (patterns_edit_actions),
91
G_CALLBACK (data_edit_data_cmd_callback));
95
patterns_actions_update (GimpActionGroup *group,
98
GimpContext *context = action_data_get_context (user_data);
99
GimpPattern *pattern = NULL;
100
GimpData *data = NULL;
104
pattern = gimp_context_get_pattern (context);
107
data = GIMP_DATA (pattern);
110
#define SET_SENSITIVE(action,condition) \
111
gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
113
SET_SENSITIVE ("patterns-edit", pattern && FALSE);
114
SET_SENSITIVE ("patterns-duplicate", pattern && GIMP_DATA_GET_CLASS (data)->duplicate);
115
SET_SENSITIVE ("patterns-delete", pattern && data->deletable);