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

« back to all changes in this revision

Viewing changes to app/actions/images-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/gimpimage.h"
 
29
 
 
30
#include "widgets/gimpactiongroup.h"
 
31
#include "widgets/gimphelp-ids.h"
 
32
 
 
33
#include "actions.h"
 
34
#include "images-actions.h"
 
35
#include "images-commands.h"
 
36
 
 
37
#include "gimp-intl.h"
 
38
 
 
39
 
 
40
static GimpActionEntry images_actions[] =
 
41
{
 
42
  { "images-popup", GIMP_STOCK_IMAGES,
 
43
    N_("Images Menu"), NULL, NULL, NULL,
 
44
    GIMP_HELP_IMAGE_DIALOG },
 
45
 
 
46
  { "images-raise-views", GTK_STOCK_GOTO_TOP,
 
47
    N_("_Raise Views"), "",
 
48
    N_("Raise this image's displays"),
 
49
    G_CALLBACK (images_raise_views_cmd_callback),
 
50
    NULL },
 
51
 
 
52
  { "images-new-view", GTK_STOCK_NEW,
 
53
    N_("_New View"), "",
 
54
    N_("Create a new display for this image"),
 
55
    G_CALLBACK (images_new_view_cmd_callback),
 
56
    NULL },
 
57
 
 
58
  { "images-delete", GTK_STOCK_DELETE,
 
59
    N_("_Delete Image"), "",
 
60
    N_("Delete this image"),
 
61
    G_CALLBACK (images_delete_image_cmd_callback),
 
62
    NULL }
 
63
};
 
64
 
 
65
 
 
66
void
 
67
images_actions_setup (GimpActionGroup *group)
 
68
{
 
69
  gimp_action_group_add_actions (group,
 
70
                                 images_actions,
 
71
                                 G_N_ELEMENTS (images_actions));
 
72
}
 
73
 
 
74
void
 
75
images_actions_update (GimpActionGroup *group,
 
76
                       gpointer         data)
 
77
{
 
78
  GimpContext *context = action_data_get_context (data);
 
79
  GimpImage   *image   = NULL;
 
80
 
 
81
  if (context)
 
82
    image = gimp_context_get_image (context);
 
83
 
 
84
#define SET_SENSITIVE(action,condition) \
 
85
        gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
 
86
 
 
87
  SET_SENSITIVE ("images-raise-views", image);
 
88
  SET_SENSITIVE ("images-new-view",    image);
 
89
  SET_SENSITIVE ("images-delete",      image && image->disp_count == 0);
 
90
 
 
91
#undef SET_SENSITIVE
 
92
}