Exemple #1
0
static void
plug_in_actions_add_proc (GimpActionGroup     *group,
                          GimpPlugInProcedure *proc)
{
  GimpProcedureActionEntry  entry;
  const gchar              *locale_domain;
  GList                    *list;

  locale_domain = gimp_plug_in_procedure_get_locale_domain (proc);

  entry.name        = gimp_object_get_name (proc);
  entry.icon_name   = gimp_viewable_get_icon_name (GIMP_VIEWABLE (proc));
  entry.label       = gimp_procedure_get_menu_label (GIMP_PROCEDURE (proc));
  entry.accelerator = NULL;
  entry.tooltip     = gimp_procedure_get_blurb (GIMP_PROCEDURE (proc));
  entry.procedure   = GIMP_PROCEDURE (proc);
  entry.help_id     = gimp_procedure_get_help_id (GIMP_PROCEDURE (proc));

  gimp_action_group_add_procedure_actions (group, &entry, 1,
                                           G_CALLBACK (plug_in_run_cmd_callback));

  for (list = proc->menu_paths; list; list = g_list_next (list))
    {
      const gchar *original   = list->data;
      const gchar *translated = dgettext (locale_domain, original);

      if (plug_in_actions_check_translation (original, translated))
        plug_in_actions_build_path (group, original, translated);
      else
        plug_in_actions_build_path (group, original, original);
    }

  if (proc->image_types_val)
    {
      GimpContext  *context  = gimp_get_user_context (group->gimp);
      GimpImage    *image    = gimp_context_get_image (context);
      GimpDrawable *drawable = NULL;
      gboolean      sensitive;
      const gchar  *tooltip;

      if (image)
        drawable = gimp_image_get_active_drawable (image);

      sensitive = gimp_procedure_get_sensitive (GIMP_PROCEDURE (proc),
                                                GIMP_OBJECT (drawable),
                                                &tooltip);

      gimp_action_group_set_action_sensitive (group,
                                              gimp_object_get_name (proc),
                                              sensitive);

      if (! sensitive && drawable && tooltip)
        gimp_action_group_set_action_tooltip (group,
                                              gimp_object_get_name (proc),
                                              tooltip);
    }
}
Exemple #2
0
static void
gimp_device_info_guess_icon (GimpDeviceInfo *info)
{
  GimpViewable *viewable = GIMP_VIEWABLE (info);

  if (gimp_object_get_name (viewable) &&
      ! strcmp (gimp_viewable_get_icon_name (viewable),
                GIMP_VIEWABLE_GET_CLASS (viewable)->default_icon_name))
    {
      const gchar *icon_name = NULL;
      gchar       *down      = g_ascii_strdown (gimp_object_get_name (viewable),
                                                -1);

      if (strstr (down, "eraser"))
        {
          icon_name = GIMP_STOCK_TOOL_ERASER;
        }
      else if (strstr (down, "pen"))
        {
          icon_name = GIMP_STOCK_TOOL_PAINTBRUSH;
        }
      else if (strstr (down, "airbrush"))
        {
          icon_name = GIMP_STOCK_TOOL_AIRBRUSH;
        }
      else if (strstr (down, "cursor")   ||
               strstr (down, "mouse")    ||
               strstr (down, "pointer")  ||
               strstr (down, "touchpad") ||
               strstr (down, "trackpoint"))
        {
          icon_name = GIMP_STOCK_CURSOR;
        }

      g_free (down);

      if (icon_name)
        gimp_viewable_set_icon_name (viewable, icon_name);
    }
}
Exemple #3
0
GimpData *
gimp_tool_preset_new (GimpContext *context,
                      const gchar *unused)
{
  GimpToolInfo *tool_info;
  const gchar  *icon_name;

  g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);

  tool_info = gimp_context_get_tool (context);

  g_return_val_if_fail (tool_info != NULL, NULL);

  icon_name = gimp_viewable_get_icon_name (GIMP_VIEWABLE (tool_info));

  return g_object_new (GIMP_TYPE_TOOL_PRESET,
                       "name",         tool_info->blurb,
                       "icon-name",    icon_name,
                       "gimp",         context->gimp,
                       "tool-options", tool_info->tool_options,
                       NULL);
}
static void
tool_options_actions_update_presets (GimpActionGroup *group,
                                     const gchar     *action_prefix,
                                     GCallback        callback,
                                     const gchar     *help_id,
                                     GimpContainer   *presets,
                                     gboolean         need_writable,
                                     gboolean         need_deletable)
{
  GList *list;
  gint   n_children = 0;
  gint   i;

  for (i = 0; ; i++)
    {
      gchar     *action_name;
      GtkAction *action;

      action_name = g_strdup_printf ("%s-%03d", action_prefix, i);
      action = gtk_action_group_get_action (GTK_ACTION_GROUP (group),
                                            action_name);
      g_free (action_name);

      if (! action)
        break;

      gtk_action_group_remove_action (GTK_ACTION_GROUP (group), action);
    }

  if (presets)
    n_children = gimp_container_get_n_children (presets);

  if (n_children > 0)
    {
      GimpEnumActionEntry entry;

      entry.name           = NULL;
      entry.label          = NULL;
      entry.accelerator    = "";
      entry.tooltip        = NULL;
      entry.value          = 0;
      entry.value_variable = FALSE;
      entry.help_id        = help_id;

      for (list = GIMP_LIST (presets)->list, i = 0;
           list;
           list = g_list_next (list), i++)
        {
          GimpObject *preset = list->data;
          GdkPixbuf  *pixbuf = NULL;

          entry.name      = g_strdup_printf ("%s-%03d", action_prefix, i);
          entry.label     = gimp_object_get_name (preset);
          entry.icon_name = gimp_viewable_get_icon_name (GIMP_VIEWABLE (preset));
          entry.value     = i;

          g_object_get (preset, "icon-pixbuf", &pixbuf, NULL);

          gimp_action_group_add_enum_actions (group, NULL, &entry, 1, callback);

          if (need_writable)
            SET_SENSITIVE (entry.name,
                           gimp_data_is_writable (GIMP_DATA (preset)));

          if (need_deletable)
            SET_SENSITIVE (entry.name,
                           gimp_data_is_deletable (GIMP_DATA (preset)));

          if (pixbuf)
            gimp_action_group_set_action_pixbuf (group, entry.name, pixbuf);

          g_free ((gchar *) entry.name);
        }
    }
}
static void
filters_actions_history_changed (Gimp            *gimp,
                                 GimpActionGroup *group)
{
  GimpProcedure   *proc;
  GimpActionGroup *plug_in_group;
  gint             i;

  plug_in_group = filters_actions_get_plug_in_group (group);

  proc = gimp_filter_history_nth (gimp, 0);

  if (proc)
    {
      GtkAction   *actual_action = NULL;
      const gchar *label;
      gchar       *repeat;
      gchar       *reshow;
      gboolean     sensitive = FALSE;

      label = gimp_procedure_get_label (proc);

      repeat = g_strdup_printf (_("Re_peat \"%s\""),  label);
      reshow = g_strdup_printf (_("R_e-Show \"%s\""), label);

      gimp_action_group_set_action_label (group, "filters-repeat", repeat);
      gimp_action_group_set_action_label (group, "filters-reshow", reshow);

      g_free (repeat);
      g_free (reshow);

      if (g_str_has_prefix (gimp_object_get_name (proc), "filters-"))
        {
          actual_action =
            gtk_action_group_get_action (GTK_ACTION_GROUP (group),
                                         gimp_object_get_name (proc));
        }
      else if (plug_in_group)
        {
          /*  copy the sensitivity of the plug-in procedure's actual
           *  action instead of calling filters_actions_update()
           *  because doing the latter would set the sensitivity of
           *  this image's action on all images' actions. See bug
           *  #517683.
           */
          actual_action =
            gtk_action_group_get_action (GTK_ACTION_GROUP (plug_in_group),
                                         gimp_object_get_name (proc));
        }

      if (actual_action)
        sensitive = gtk_action_get_sensitive (actual_action);

      gimp_action_group_set_action_sensitive (group, "filters-repeat",
                                              sensitive);
      gimp_action_group_set_action_sensitive (group, "filters-reshow",
                                              sensitive);
    }
  else
    {
      gimp_action_group_set_action_label (group, "filters-repeat",
                                          _("Repeat Last"));
      gimp_action_group_set_action_label (group, "filters-reshow",
                                          _("Re-Show Last"));

      gimp_action_group_set_action_sensitive (group, "filters-repeat", FALSE);
      gimp_action_group_set_action_sensitive (group, "filters-reshow", FALSE);
    }

  for (i = 0; i < gimp_filter_history_length (gimp); i++)
    {
      GtkAction   *action;
      GtkAction   *actual_action = NULL;
      const gchar *label;
      gchar       *name;
      gboolean     sensitive = FALSE;

      name = g_strdup_printf ("filter-recent-%02d", i + 1);
      action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), name);
      g_free (name);

      proc = gimp_filter_history_nth (gimp, i);

      label = gimp_procedure_get_menu_label (proc);

      if (g_str_has_prefix (gimp_object_get_name (proc), "filters-"))
        {
          actual_action =
            gtk_action_group_get_action (GTK_ACTION_GROUP (group),
                                         gimp_object_get_name (proc));
        }
      else if (plug_in_group)
        {
          /*  see comment above  */
          actual_action =
            gtk_action_group_get_action (GTK_ACTION_GROUP (plug_in_group),
                                         gimp_object_get_name (proc));
        }

      if (actual_action)
        sensitive = gtk_action_get_sensitive (actual_action);

      g_object_set (action,
                    "visible",   TRUE,
                    "sensitive", sensitive,
                    "procedure", proc,
                    "label",     label,
                    "icon-name", gimp_viewable_get_icon_name (GIMP_VIEWABLE (proc)),
                    "tooltip",   gimp_procedure_get_blurb (proc),
                    NULL);
    }

  for (; i < gimp_filter_history_size (gimp); i++)
    {
      GtkAction *action;
      gchar     *name = g_strdup_printf ("filter-recent-%02d", i + 1);

      action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), name);
      g_free (name);

      g_object_set (action,
                    "visible",   FALSE,
                    "procedure", NULL,
                    NULL);
    }
}
Exemple #6
0
void
tools_actions_setup (GimpActionGroup *group)
{
  GtkAction *action;
  GList     *list;

  gimp_action_group_add_actions (group, "tools-action",
                                 tools_actions,
                                 G_N_ELEMENTS (tools_actions));

  gimp_action_group_add_string_actions (group, "tools-action",
                                        tools_alternative_actions,
                                        G_N_ELEMENTS (tools_alternative_actions),
                                        G_CALLBACK (tools_select_cmd_callback));

  action = gtk_action_group_get_action (GTK_ACTION_GROUP (group),
                                        "tools-by-color-select-short");
  gtk_action_set_accel_path (action, "<Actions>/tools/tools-by-color-select");

  gimp_action_group_add_enum_actions (group, NULL,
                                      tools_color_average_radius_actions,
                                      G_N_ELEMENTS (tools_color_average_radius_actions),
                                      G_CALLBACK (tools_color_average_radius_cmd_callback));

  gimp_action_group_add_enum_actions (group, NULL,
                                      tools_paintbrush_size_actions,
                                      G_N_ELEMENTS (tools_paintbrush_size_actions),
                                      G_CALLBACK (tools_paintbrush_size_cmd_callback));

  gimp_action_group_add_enum_actions (group, NULL,
                                      tools_paintbrush_angle_actions,
                                      G_N_ELEMENTS (tools_paintbrush_angle_actions),
                                      G_CALLBACK (tools_paintbrush_angle_cmd_callback));

  gimp_action_group_add_enum_actions (group, NULL,
                                      tools_paintbrush_aspect_ratio_actions,
                                      G_N_ELEMENTS (tools_paintbrush_aspect_ratio_actions),
                                      G_CALLBACK (tools_paintbrush_aspect_ratio_cmd_callback));

  gimp_action_group_add_enum_actions (group, NULL,
                                      tools_ink_blob_size_actions,
                                      G_N_ELEMENTS (tools_ink_blob_size_actions),
                                      G_CALLBACK (tools_ink_blob_size_cmd_callback));
  gimp_action_group_add_enum_actions (group, NULL,
                                      tools_ink_blob_aspect_actions,
                                      G_N_ELEMENTS (tools_ink_blob_aspect_actions),
                                      G_CALLBACK (tools_ink_blob_aspect_cmd_callback));
  gimp_action_group_add_enum_actions (group, NULL,
                                      tools_ink_blob_angle_actions,
                                      G_N_ELEMENTS (tools_ink_blob_angle_actions),
                                      G_CALLBACK (tools_ink_blob_angle_cmd_callback));

  gimp_action_group_add_enum_actions (group, NULL,
                                      tools_airbrush_rate_actions,
                                      G_N_ELEMENTS (tools_airbrush_rate_actions),
                                      G_CALLBACK (tools_airbrush_rate_cmd_callback));
  gimp_action_group_add_enum_actions (group, NULL,
                                      tools_airbrush_flow_actions,
                                      G_N_ELEMENTS (tools_airbrush_flow_actions),
                                      G_CALLBACK (tools_airbrush_flow_cmd_callback));

#ifdef HAVE_LIBMYPAINT
  if (GIMP_GUI_CONFIG (group->gimp->config)->playground_mybrush_tool)
    gimp_action_group_add_enum_actions (group, NULL,
                                        tools_mybrush_radius_actions,
                                        G_N_ELEMENTS (tools_mybrush_radius_actions),
                                        G_CALLBACK (tools_mybrush_radius_cmd_callback));
#endif

  gimp_action_group_add_enum_actions (group, NULL,
                                      tools_foreground_select_brush_size_actions,
                                      G_N_ELEMENTS (tools_foreground_select_brush_size_actions),
                                      G_CALLBACK (tools_fg_select_brush_size_cmd_callback));

  gimp_action_group_add_enum_actions (group, NULL,
                                      tools_transform_preview_opacity_actions,
                                      G_N_ELEMENTS (tools_transform_preview_opacity_actions),
                                      G_CALLBACK (tools_transform_preview_opacity_cmd_callback));

  gimp_action_group_add_enum_actions (group, NULL,
                                      tools_warp_effect_size_actions,
                                      G_N_ELEMENTS (tools_warp_effect_size_actions),
                                      G_CALLBACK (tools_warp_effect_size_cmd_callback));

  gimp_action_group_add_enum_actions (group, NULL,
                                      tools_opacity_actions,
                                      G_N_ELEMENTS (tools_opacity_actions),
                                      G_CALLBACK (tools_opacity_cmd_callback));
  gimp_action_group_add_enum_actions (group, NULL,
                                      tools_size_actions,
                                      G_N_ELEMENTS (tools_size_actions),
                                      G_CALLBACK (tools_size_cmd_callback));
  gimp_action_group_add_enum_actions (group, NULL,
                                      tools_aspect_actions,
                                      G_N_ELEMENTS (tools_aspect_actions),
                                      G_CALLBACK (tools_aspect_cmd_callback));
  gimp_action_group_add_enum_actions (group, NULL,
                                      tools_angle_actions,
                                      G_N_ELEMENTS (tools_angle_actions),
                                      G_CALLBACK (tools_angle_cmd_callback));

  gimp_action_group_add_enum_actions (group, NULL,
                                      tools_object_1_actions,
                                      G_N_ELEMENTS (tools_object_1_actions),
                                      G_CALLBACK (tools_object_1_cmd_callback));
  gimp_action_group_add_enum_actions (group, NULL,
                                      tools_object_2_actions,
                                      G_N_ELEMENTS (tools_object_2_actions),
                                      G_CALLBACK (tools_object_2_cmd_callback));

  for (list = gimp_get_tool_info_iter (group->gimp);
       list;
       list = g_list_next (list))
    {
      GimpToolInfo *tool_info = list->data;

      if (tool_info->menu_label)
        {
          GimpStringActionEntry  entry;
          const gchar           *icon_name;
          const gchar           *identifier;
          gchar                 *tmp;
          gchar                 *name;

          icon_name  = gimp_viewable_get_icon_name (GIMP_VIEWABLE (tool_info));
          identifier = gimp_object_get_name (tool_info);

          tmp = g_strndup (identifier + strlen ("gimp-"),
                           strlen (identifier) - strlen ("gimp--tool"));
          name = g_strdup_printf ("tools-%s", tmp);
          g_free (tmp);

          entry.name        = name;
          entry.icon_name   = icon_name;
          entry.label       = tool_info->menu_label;
          entry.accelerator = tool_info->menu_accel;
          entry.tooltip     = tool_info->help;
          entry.help_id     = tool_info->help_id;
          entry.value       = identifier;

          gimp_action_group_add_string_actions (group, NULL,
                                                &entry, 1,
                                                G_CALLBACK (tools_select_cmd_callback));

          g_free (name);
        }
    }
}
void
gimp_image_map_tool_get_operation (GimpImageMapTool *im_tool)
{
  GimpImageMapToolClass *klass;
  GimpToolInfo          *tool_info;
  gchar                 *operation_name;

  g_return_if_fail (GIMP_IS_IMAGE_MAP_TOOL (im_tool));

  klass = GIMP_IMAGE_MAP_TOOL_GET_CLASS (im_tool);

  tool_info = GIMP_TOOL (im_tool)->tool_info;

  if (im_tool->image_map)
    {
      gimp_image_map_abort (im_tool->image_map);
      g_object_unref (im_tool->image_map);
      im_tool->image_map = NULL;
    }

  if (im_tool->operation)
    {
      g_object_unref (im_tool->operation);
      im_tool->operation = NULL;
    }

  if (im_tool->config)
    {
      g_signal_handlers_disconnect_by_func (im_tool->config,
                                            gimp_image_map_tool_config_notify,
                                            im_tool);

      g_object_unref (im_tool->config);
      im_tool->config = NULL;
    }

  if (im_tool->default_config)
    {
      g_object_unref (im_tool->default_config);
      im_tool->default_config = NULL;
    }

  if (im_tool->title)
    {
      g_free (im_tool->title);
      im_tool->title = NULL;
    }

  if (im_tool->description)
    {
      g_free (im_tool->description);
      im_tool->description = NULL;
    }

  if (im_tool->undo_desc)
    {
      g_free (im_tool->undo_desc);
      im_tool->undo_desc = NULL;
    }

  if (im_tool->icon_name)
    {
      g_free (im_tool->icon_name);
      im_tool->icon_name = NULL;
    }

  if (im_tool->help_id)
    {
      g_free (im_tool->help_id);
      im_tool->help_id = NULL;
    }

  operation_name = klass->get_operation (im_tool,
                                         &im_tool->title,
                                         &im_tool->description,
                                         &im_tool->undo_desc,
                                         &im_tool->icon_name,
                                         &im_tool->help_id);

  if (! operation_name)
    operation_name = g_strdup ("gegl:nop");

  if (! im_tool->title)
    im_tool->title = g_strdup (tool_info->blurb);

  if (! im_tool->description)
    im_tool->description = g_strdup (im_tool->title);

  if (! im_tool->undo_desc)
    im_tool->undo_desc = g_strdup (tool_info->blurb);

  if (! im_tool->icon_name)
    im_tool->icon_name =
      g_strdup (gimp_viewable_get_icon_name (GIMP_VIEWABLE (tool_info)));

  if (! im_tool->help_id)
    im_tool->help_id = g_strdup (tool_info->help_id);

  im_tool->operation = gegl_node_new_child (NULL,
                                            "operation", operation_name,
                                            NULL);
  im_tool->config = G_OBJECT (gimp_gegl_config_new (operation_name,
                                                    im_tool->icon_name,
                                                    GIMP_TYPE_SETTINGS));

  gimp_gegl_config_sync_node (GIMP_OBJECT (im_tool->config),
                              im_tool->operation);
  gimp_gegl_config_connect_node (GIMP_OBJECT (im_tool->config),
                                 im_tool->operation);

  if (im_tool->gui)
    {
      gimp_tool_gui_set_title       (im_tool->gui, im_tool->title);
      gimp_tool_gui_set_description (im_tool->gui, im_tool->description);
      gimp_tool_gui_set_icon_name   (im_tool->gui, im_tool->icon_name);
      gimp_tool_gui_set_help_id     (im_tool->gui, im_tool->help_id);
    }

  if (gegl_operation_get_key (operation_name, "position-dependent"))
    {
      if (im_tool->gui)
        gtk_widget_show (im_tool->region_combo);
    }
  else
    {
      if (im_tool->gui)
        gtk_widget_hide (im_tool->region_combo);

      g_object_set (GIMP_IMAGE_MAP_TOOL_GET_OPTIONS (im_tool),
                    "region", GIMP_IMAGE_MAP_REGION_SELECTION,
                    NULL);
    }

  g_free (operation_name);

  g_object_set (GIMP_IMAGE_MAP_TOOL_GET_OPTIONS (im_tool),
                "preview-split",    FALSE,
                "preview-position", 0.5,
                NULL);

  if (im_tool->config)
    g_signal_connect_object (im_tool->config, "notify",
                             G_CALLBACK (gimp_image_map_tool_config_notify),
                             G_OBJECT (im_tool), 0);

  if (GIMP_TOOL (im_tool)->drawable)
    gimp_image_map_tool_create_map (im_tool);
}
static void
gimp_view_renderer_image_render (GimpViewRenderer *renderer,
                                 GtkWidget        *widget)
{
  GimpViewRendererImage *rendererimage = GIMP_VIEW_RENDERER_IMAGE (renderer);
  GimpImage             *image         = GIMP_IMAGE (renderer->viewable);
  const gchar           *icon_name;

  /* The conditions checked here are mostly a hack to hide the fact that
   * we are creating the channel preview from the image preview and turning
   * off visibility of a channel has the side-effect of painting the channel
   * preview all black. See bug #459518 for details.
   */
  if (rendererimage->channel == -1 ||
      (gimp_image_get_component_visible (image, rendererimage->channel) &&
       gimp_image_get_component_visible (image, GIMP_ALPHA_CHANNEL)))
    {
      gint         view_width;
      gint         view_height;
      gdouble      xres;
      gdouble      yres;
      gboolean     scaling_up;
      GimpTempBuf *render_buf = NULL;

      gimp_image_get_resolution (image, &xres, &yres);

      gimp_viewable_calc_preview_size (gimp_image_get_width  (image),
                                       gimp_image_get_height (image),
                                       renderer->width,
                                       renderer->height,
                                       renderer->dot_for_dot,
                                       xres,
                                       yres,
                                       &view_width,
                                       &view_height,
                                       &scaling_up);

      if (scaling_up)
        {
          GimpTempBuf *temp_buf;

          temp_buf = gimp_viewable_get_new_preview (renderer->viewable,
                                                    renderer->context,
                                                    gimp_image_get_width  (image),
                                                    gimp_image_get_height (image));

          if (temp_buf)
            {
              render_buf = gimp_temp_buf_scale (temp_buf,
                                                view_width, view_height);
              gimp_temp_buf_unref (temp_buf);
            }
        }
      else
        {
          render_buf = gimp_viewable_get_new_preview (renderer->viewable,
                                                      renderer->context,
                                                      view_width,
                                                      view_height);
        }

      if (render_buf)
        {
          gint render_buf_x    = 0;
          gint render_buf_y    = 0;
          gint component_index = -1;

          /*  xresolution != yresolution */
          if (view_width > renderer->width || view_height > renderer->height)
            {
              GimpTempBuf *temp_buf;

              temp_buf = gimp_temp_buf_scale (render_buf,
                                              renderer->width, renderer->height);
              gimp_temp_buf_unref (render_buf);
              render_buf = temp_buf;
            }

          if (view_width  < renderer->width)
            render_buf_x = (renderer->width  - view_width)  / 2;

          if (view_height < renderer->height)
            render_buf_y = (renderer->height - view_height) / 2;

          if (rendererimage->channel != -1)
            component_index =
              gimp_image_get_component_index (image, rendererimage->channel);

          gimp_view_renderer_render_temp_buf (renderer, widget, render_buf,
                                              render_buf_x, render_buf_y,
                                              component_index,
                                              GIMP_VIEW_BG_CHECKS,
                                              GIMP_VIEW_BG_WHITE);
          gimp_temp_buf_unref (render_buf);

          return;
        }
    }

  switch (rendererimage->channel)
    {
    case GIMP_RED_CHANNEL:     icon_name = GIMP_STOCK_CHANNEL_RED;     break;
    case GIMP_GREEN_CHANNEL:   icon_name = GIMP_STOCK_CHANNEL_GREEN;   break;
    case GIMP_BLUE_CHANNEL:    icon_name = GIMP_STOCK_CHANNEL_BLUE;    break;
    case GIMP_GRAY_CHANNEL:    icon_name = GIMP_STOCK_CHANNEL_GRAY;    break;
    case GIMP_INDEXED_CHANNEL: icon_name = GIMP_STOCK_CHANNEL_INDEXED; break;
    case GIMP_ALPHA_CHANNEL:   icon_name = GIMP_STOCK_CHANNEL_ALPHA;   break;

    default:
      icon_name = gimp_viewable_get_icon_name (renderer->viewable);
      break;
    }

  gimp_view_renderer_render_icon (renderer, widget, icon_name);
}