~ubuntu-branches/ubuntu/vivid/gimp/vivid

« back to all changes in this revision

Viewing changes to app/actions/brushes-actions.c

  • Committer: Package Import Robot
  • Author(s): Jordi Mallach
  • Date: 2012-05-08 18:50:03 UTC
  • mto: (1.1.26) (0.5.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 71.
  • Revision ID: package-import@ubuntu.com-20120508185003-tltkvbaysf8d2426
ImportĀ upstreamĀ versionĀ 2.8.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* GIMP - The GNU Image Manipulation Program
2
2
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
3
3
 *
4
 
 * This program is free software; you can redistribute it and/or modify
 
4
 * This program is free software: you can redistribute it and/or modify
5
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
 
6
 * the Free Software Foundation; either version 3 of the License, or
7
7
 * (at your option) any later version.
8
8
 *
9
9
 * This program is distributed in the hope that it will be useful,
12
12
 * GNU General Public License for more details.
13
13
 *
14
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.
 
15
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
16
 */
18
17
 
19
18
#include "config.h"
40
39
static const GimpActionEntry brushes_actions[] =
41
40
{
42
41
  { "brushes-popup", GIMP_STOCK_BRUSH,
43
 
    N_("Brushes Menu"), NULL, NULL, NULL,
 
42
    NC_("brushes-action", "Brushes Menu"), NULL, NULL, NULL,
44
43
    GIMP_HELP_BRUSH_DIALOG },
45
44
 
46
45
  { "brushes-open-as-image", GTK_STOCK_OPEN,
47
 
    N_("_Open Brush as Image"), "",
48
 
    N_("Open brush as image"),
 
46
    NC_("brushes-action", "_Open Brush as Image"), "",
 
47
    NC_("brushes-action", "Open brush as image"),
49
48
    G_CALLBACK (data_open_as_image_cmd_callback),
50
49
    GIMP_HELP_BRUSH_OPEN_AS_IMAGE },
51
50
 
52
51
  { "brushes-new", GTK_STOCK_NEW,
53
 
    N_("_New Brush"), "",
54
 
    N_("New brush"),
 
52
    NC_("brushes-action", "_New Brush"), "",
 
53
    NC_("brushes-action", "Create a new brush"),
55
54
    G_CALLBACK (data_new_cmd_callback),
56
55
    GIMP_HELP_BRUSH_NEW },
57
56
 
58
57
  { "brushes-duplicate", GIMP_STOCK_DUPLICATE,
59
 
    N_("D_uplicate Brush"), NULL,
60
 
    N_("Duplicate brush"),
 
58
    NC_("brushes-action", "D_uplicate Brush"), NULL,
 
59
    NC_("brushes-action", "Duplicate this brush"),
61
60
    G_CALLBACK (data_duplicate_cmd_callback),
62
61
    GIMP_HELP_BRUSH_DUPLICATE },
63
62
 
64
63
  { "brushes-copy-location", GTK_STOCK_COPY,
65
 
    N_("Copy Brush _Location"), "",
66
 
    N_("Copy brush file location to clipboard"),
 
64
    NC_("brushes-action", "Copy Brush _Location"), "",
 
65
    NC_("brushes-action", "Copy brush file location to clipboard"),
67
66
    G_CALLBACK (data_copy_location_cmd_callback),
68
67
    GIMP_HELP_BRUSH_COPY_LOCATION },
69
68
 
70
69
  { "brushes-delete", GTK_STOCK_DELETE,
71
 
    N_("_Delete Brush"), "",
72
 
    N_("Delete brush"),
 
70
    NC_("brushes-action", "_Delete Brush"), "",
 
71
    NC_("brushes-action", "Delete this brush"),
73
72
    G_CALLBACK (data_delete_cmd_callback),
74
73
    GIMP_HELP_BRUSH_DELETE },
75
74
 
76
75
  { "brushes-refresh", GTK_STOCK_REFRESH,
77
 
    N_("_Refresh Brushes"), "",
78
 
    N_("Refresh brushes"),
 
76
    NC_("brushes-action", "_Refresh Brushes"), "",
 
77
    NC_("brushes-action", "Refresh brushes"),
79
78
    G_CALLBACK (data_refresh_cmd_callback),
80
79
    GIMP_HELP_BRUSH_REFRESH }
81
80
};
83
82
static const GimpStringActionEntry brushes_edit_actions[] =
84
83
{
85
84
  { "brushes-edit", GTK_STOCK_EDIT,
86
 
    N_("_Edit Brush..."), NULL,
87
 
    N_("Edit brush"),
 
85
    NC_("brushes-action", "_Edit Brush..."), NULL,
 
86
    NC_("brushes-action", "Edit this brush"),
88
87
    "gimp-brush-editor",
89
88
    GIMP_HELP_BRUSH_EDIT }
90
89
};
93
92
void
94
93
brushes_actions_setup (GimpActionGroup *group)
95
94
{
96
 
  gimp_action_group_add_actions (group,
 
95
  gimp_action_group_add_actions (group, "brushes-action",
97
96
                                 brushes_actions,
98
97
                                 G_N_ELEMENTS (brushes_actions));
99
98
 
100
 
  gimp_action_group_add_string_actions (group,
 
99
  gimp_action_group_add_string_actions (group, "brushes-action",
101
100
                                        brushes_edit_actions,
102
101
                                        G_N_ELEMENTS (brushes_edit_actions),
103
102
                                        G_CALLBACK (data_edit_cmd_callback));
107
106
brushes_actions_update (GimpActionGroup *group,
108
107
                        gpointer         user_data)
109
108
{
110
 
  GimpContext *context = action_data_get_context (user_data);
111
 
  GimpBrush   *brush   = NULL;
112
 
  GimpData    *data    = NULL;
 
109
  GimpContext *context  = action_data_get_context (user_data);
 
110
  GimpBrush   *brush    = NULL;
 
111
  GimpData    *data     = NULL;
 
112
  const gchar *filename = NULL;
113
113
 
114
114
  if (context)
115
115
    {
116
116
      brush = gimp_context_get_brush (context);
117
117
 
 
118
      if (action_data_sel_count (user_data) > 1)
 
119
        {
 
120
          brush = NULL;
 
121
        }
 
122
 
118
123
      if (brush)
119
 
        data = GIMP_DATA (brush);
 
124
        {
 
125
          data = GIMP_DATA (brush);
 
126
 
 
127
          filename = gimp_data_get_filename (data);
 
128
        }
120
129
    }
121
130
 
122
131
#define SET_SENSITIVE(action,condition) \
123
132
        gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
124
133
 
125
134
  SET_SENSITIVE ("brushes-edit",          brush);
126
 
  SET_SENSITIVE ("brushes-open-as-image", brush && data->filename && ! GIMP_IS_BRUSH_GENERATED (brush));
 
135
  SET_SENSITIVE ("brushes-open-as-image", brush && filename && ! GIMP_IS_BRUSH_GENERATED (brush));
127
136
  SET_SENSITIVE ("brushes-duplicate",     brush && GIMP_DATA_GET_CLASS (data)->duplicate);
128
 
  SET_SENSITIVE ("brushes-copy-location", brush && data->filename);
129
 
  SET_SENSITIVE ("brushes-delete",        brush && data->deletable);
 
137
  SET_SENSITIVE ("brushes-copy-location", brush && filename);
 
138
  SET_SENSITIVE ("brushes-delete",        brush && gimp_data_is_deletable (data));
130
139
 
131
140
#undef SET_SENSITIVE
132
141
}