improved code to set the image mode radio actions; set their sensitivity

2006-06-15  Sven Neumann  <sven@gimp.org>

	* app/actions/image-actions.c (image_actions_update): improved
	code to set the image mode radio actions; set their sensitivity
	also.

	* app/actions/image-commands.c
(image_configure_grid_cmd_callback):
	fixed cast to silence compiler warning.
This commit is contained in:
Sven Neumann 2006-06-15 19:37:15 +00:00 committed by Sven Neumann
parent 0fdaafe37e
commit 2772ef8d8b
3 changed files with 34 additions and 19 deletions

View file

@ -1,3 +1,12 @@
2006-06-15 Sven Neumann <sven@gimp.org>
* app/actions/image-actions.c (image_actions_update): improved
code to set the image mode radio actions; set their sensitivity
also.
* app/actions/image-commands.c (image_configure_grid_cmd_callback):
fixed cast to silence compiler warning.
2006-06-15 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpdockbook.c (gimp_dockbook_get_tab_widget): set

View file

@ -230,24 +230,32 @@ void
image_actions_update (GimpActionGroup *group,
gpointer data)
{
GimpImage *image = action_data_get_image (data);
gboolean is_rgb = FALSE;
gboolean is_gray = FALSE;
gboolean is_indexed = FALSE;
gboolean fs = FALSE;
gboolean aux = FALSE;
gboolean lp = FALSE;
gboolean sel = FALSE;
GimpImage *image = action_data_get_image (data);
gboolean fs = FALSE;
gboolean aux = FALSE;
gboolean lp = FALSE;
gboolean sel = FALSE;
if (image)
{
GimpImageBaseType base_type;
const gchar *action = NULL;
base_type = gimp_image_base_type (image);
switch (gimp_image_base_type (image))
{
case GIMP_RGB:
action = "image-convert-rgb";
break;
is_rgb = (base_type == GIMP_RGB);
is_gray = (base_type == GIMP_GRAY);
is_indexed = (base_type == GIMP_INDEXED);
case GIMP_GRAY:
action = "image-convert-grayscale";
break;
case GIMP_INDEXED:
action = "image-convert-indexed";
break;
}
gimp_action_group_set_action_active (group, action, TRUE);
fs = (gimp_image_floating_sel (image) != NULL);
aux = (gimp_image_get_active_channel (image) != NULL);
@ -255,14 +263,12 @@ image_actions_update (GimpActionGroup *group,
sel = ! gimp_channel_is_empty (gimp_image_get_mask (image));
}
#define SET_ACTIVE(action,condition) \
gimp_action_group_set_action_active (group, action, (condition) != 0)
#define SET_SENSITIVE(action,condition) \
gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
SET_ACTIVE ("image-convert-rgb", image && is_rgb);
SET_ACTIVE ("image-convert-grayscale", image && is_gray);
SET_ACTIVE ("image-convert-indexed", image && is_indexed);
SET_SENSITIVE ("image-convert-rgb", image);
SET_SENSITIVE ("image-convert-grayscale", image);
SET_SENSITIVE ("image-convert-indexed", image);
SET_SENSITIVE ("image-flip-horizontal", image);
SET_SENSITIVE ("image-flip-vertical", image);

View file

@ -429,7 +429,7 @@ image_configure_grid_cmd_callback (GtkAction *action,
TRUE);
g_object_add_weak_pointer (G_OBJECT (shell->grid_dialog),
(gpointer *) &shell->grid_dialog);
(gpointer) &shell->grid_dialog);
}
gtk_window_present (GTK_WINDOW (shell->grid_dialog));