~ubuntu-branches/ubuntu/breezy/gimp/breezy

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2005-10-04 19:04:46 UTC
  • Revision ID: james.westby@ubuntu.com-20051004190446-ukh32kwk56s4sjhu
Tags: upstream-2.2.8
ImportĀ upstreamĀ versionĀ 2.2.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* The GIMP -- an image manipulation program
 
2
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
 
3
 *
 
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.
 
8
 *
 
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.
 
13
 *
 
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.
 
17
 */
 
18
 
 
19
#include "config.h"
 
20
 
 
21
#include <gtk/gtk.h>
 
22
 
 
23
#include "libgimpwidgets/gimpwidgets.h"
 
24
 
 
25
#include "actions-types.h"
 
26
 
 
27
#include "core/gimpcontext.h"
 
28
#include "core/gimpdata.h"
 
29
 
 
30
#include "widgets/gimpactiongroup.h"
 
31
#include "widgets/gimphelp-ids.h"
 
32
 
 
33
#include "actions.h"
 
34
#include "data-commands.h"
 
35
#include "patterns-actions.h"
 
36
 
 
37
#include "gimp-intl.h"
 
38
 
 
39
 
 
40
static GimpActionEntry patterns_actions[] =
 
41
{
 
42
  { "patterns-popup", GIMP_STOCK_PATTERN,
 
43
    N_("Patterns Menu"), NULL, NULL, NULL,
 
44
    GIMP_HELP_PATTERN_DIALOG },
 
45
 
 
46
  { "patterns-new", GTK_STOCK_NEW,
 
47
    N_("_New Pattern"), "",
 
48
    N_("New pattern"),
 
49
    G_CALLBACK (data_new_data_cmd_callback),
 
50
    GIMP_HELP_PATTERN_NEW },
 
51
 
 
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 },
 
57
 
 
58
  { "patterns-delete", GTK_STOCK_DELETE,
 
59
    N_("_Delete Pattern..."), "",
 
60
    N_("Delete pattern"),
 
61
    G_CALLBACK (data_delete_data_cmd_callback),
 
62
    GIMP_HELP_PATTERN_DELETE },
 
63
 
 
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 }
 
69
};
 
70
 
 
71
static GimpStringActionEntry patterns_edit_actions[] =
 
72
{
 
73
  { "patterns-edit", GIMP_STOCK_EDIT,
 
74
    N_("_Edit Pattern..."), NULL,
 
75
    N_("Edit pattern"),
 
76
    "gimp-pattern-editor",
 
77
    GIMP_HELP_PATTERN_EDIT }
 
78
};
 
79
 
 
80
 
 
81
void
 
82
patterns_actions_setup (GimpActionGroup *group)
 
83
{
 
84
  gimp_action_group_add_actions (group,
 
85
                                 patterns_actions,
 
86
                                 G_N_ELEMENTS (patterns_actions));
 
87
 
 
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));
 
92
}
 
93
 
 
94
void
 
95
patterns_actions_update (GimpActionGroup *group,
 
96
                         gpointer         user_data)
 
97
{
 
98
  GimpContext *context = action_data_get_context (user_data);
 
99
  GimpPattern *pattern = NULL;
 
100
  GimpData    *data    = NULL;
 
101
 
 
102
  if (context)
 
103
    {
 
104
      pattern = gimp_context_get_pattern (context);
 
105
 
 
106
      if (pattern)
 
107
        data = GIMP_DATA (pattern);
 
108
    }
 
109
 
 
110
#define SET_SENSITIVE(action,condition) \
 
111
        gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
 
112
 
 
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);
 
116
 
 
117
#undef SET_SENSITIVE
 
118
}