コード例 #1
0
ファイル: plug-in-actions.c プロジェクト: jiapei100/gimp
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);
    }
}
コード例 #2
0
void
gimp_display_shell_set_action_sensitive (GimpDisplayShell *shell,
                                         const gchar      *action,
                                         gboolean          sensitive)
{
  GimpImageWindow *window;
  GimpContext     *context;

  g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
  g_return_if_fail (action != NULL);

  window = gimp_display_shell_get_window (shell);

  if (window && gimp_image_window_get_active_shell (window) == shell)
    {
      GimpUIManager   *manager = gimp_image_window_get_ui_manager (window);
      GimpActionGroup *action_group;

      action_group = gimp_ui_manager_get_action_group (manager, "view");

      if (action_group)
        gimp_action_group_set_action_sensitive (action_group, action, sensitive);
    }

  context = gimp_get_user_context (shell->display->gimp);

  if (shell->display == gimp_context_get_display (context))
    {
      GimpActionGroup *action_group;

      action_group = gimp_ui_manager_get_action_group (shell->popup_manager,
                                                       "view");

      if (action_group)
        gimp_action_group_set_action_sensitive (action_group, action, sensitive);
    }
}
コード例 #3
0
ファイル: plug-in-actions.c プロジェクト: jiapei100/gimp
void
plug_in_actions_update (GimpActionGroup *group,
                        gpointer         data)
{
  GimpImage         *image    = action_data_get_image (data);
  GimpPlugInManager *manager  = group->gimp->plug_in_manager;
  GimpDrawable      *drawable = NULL;
  GSList            *list;

  if (image)
    drawable = gimp_image_get_active_drawable (image);

  for (list = manager->plug_in_procedures; list; list = g_slist_next (list))
    {
      GimpPlugInProcedure *proc = list->data;

      if (proc->menu_label  &&
          ! proc->file_proc &&
          proc->image_types_val)
        {
          GimpProcedure *procedure = GIMP_PROCEDURE (proc);
          gboolean       sensitive;
          const gchar   *tooltip;

          sensitive = gimp_procedure_get_sensitive (procedure,
                                                    GIMP_OBJECT (drawable),
                                                    &tooltip);

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

          if (sensitive || ! drawable || ! tooltip)
            tooltip = gimp_procedure_get_blurb (procedure);

          gimp_action_group_set_action_tooltip (group,
                                                gimp_object_get_name (proc),
                                                tooltip);
        }
    }
}
コード例 #4
0
ファイル: plug-in-actions.c プロジェクト: Zandoch/gimp
static void
plug_in_actions_history_changed (GimpPlugInManager *manager,
                                 GimpActionGroup   *group)
{
    GimpPlugInProcedure *proc;
    gint                 i;

    proc = gimp_plug_in_manager_history_nth (manager, 0);

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

        /*  copy the sensitivity of the plug-in procedure's actual action
         *  instead of calling plug_in_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 (group),
                        GIMP_OBJECT (proc)->name);
        if (actual_action)
            sensitive = gtk_action_get_sensitive (actual_action);

        label = gimp_plug_in_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, "plug-in-repeat", repeat);
        gimp_action_group_set_action_label (group, "plug-in-reshow", reshow);

        gimp_action_group_set_action_sensitive (group, "plug-in-repeat", sensitive);
        gimp_action_group_set_action_sensitive (group, "plug-in-reshow", sensitive);

        g_free (repeat);
        g_free (reshow);
    }
    else
    {
        gimp_action_group_set_action_label (group, "plug-in-repeat",
                                            _("Repeat Last"));
        gimp_action_group_set_action_label (group, "plug-in-reshow",
                                            _("Re-Show Last"));

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

    for (i = 0; i < gimp_plug_in_manager_history_length (manager); i++)
    {
        GtkAction *action;
        GtkAction *actual_action;
        gchar     *name      = g_strdup_printf ("plug-in-recent-%02d", i + 1);
        gboolean   sensitive = FALSE;

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

        proc = gimp_plug_in_manager_history_nth (manager, i);

        /*  see comment above  */
        actual_action = gtk_action_group_get_action (GTK_ACTION_GROUP (group),
                        GIMP_OBJECT (proc)->name);
        if (actual_action)
            sensitive = gtk_action_get_sensitive (actual_action);

        g_object_set (action,
                      "visible",   TRUE,
                      "sensitive", sensitive,
                      "procedure", proc,
                      "label",     gimp_plug_in_procedure_get_label (proc),
                      "stock-id",  gimp_plug_in_procedure_get_stock_id (proc),
                      "tooltip",   gimp_plug_in_procedure_get_blurb (proc),
                      NULL);
    }

    for (; i < gimp_plug_in_manager_history_size (manager); i++)
    {
        GtkAction *action;
        gchar     *name = g_strdup_printf ("plug-in-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);
    }
}
コード例 #5
0
ファイル: plug-in-actions.c プロジェクト: Zandoch/gimp
void
plug_in_actions_update (GimpActionGroup *group,
                        gpointer         data)
{
    GimpImage         *image = action_data_get_image (data);
    GimpPlugInManager *manager;
    GimpImageType      type  = -1;
    GSList            *list;
    gint               i;

    manager = group->gimp->plug_in_manager;

    if (image)
    {
        GimpDrawable *drawable = gimp_image_get_active_drawable (image);

        if (drawable)
            type = gimp_drawable_type (drawable);
    }

    for (list = manager->plug_in_procedures; list; list = g_slist_next (list))
    {
        GimpPlugInProcedure *proc = list->data;

        if ((proc->menu_label || proc->menu_paths) &&
                ! proc->file_proc                      &&
                proc->image_types_val)
        {
            gboolean sensitive = gimp_plug_in_procedure_get_sensitive (proc, type);

            gimp_action_group_set_action_sensitive (group,
                                                    GIMP_OBJECT (proc)->name,
                                                    sensitive);
        }
    }

    if (manager->history &&
            gimp_plug_in_procedure_get_sensitive (manager->history->data, type))
    {
        gimp_action_group_set_action_sensitive (group, "plug-in-repeat", TRUE);
        gimp_action_group_set_action_sensitive (group, "plug-in-reshow", TRUE);
    }
    else
    {
        gimp_action_group_set_action_sensitive (group, "plug-in-repeat", FALSE);
        gimp_action_group_set_action_sensitive (group, "plug-in-reshow", FALSE);
    }

    for (list = manager->history, i = 0; list; list = list->next, i++)
    {
        GimpPlugInProcedure *proc = list->data;
        gchar               *name = g_strdup_printf ("plug-in-recent-%02d",
                                    i + 1);
        gboolean             sensitive;

        sensitive = gimp_plug_in_procedure_get_sensitive (proc, type);

        gimp_action_group_set_action_sensitive (group, name, sensitive);

        g_free (name);
    }
}
コード例 #6
0
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);
    }
}
コード例 #7
0
void
filters_actions_update (GimpActionGroup *group,
                        gpointer         data)
{
  GimpImage    *image;
  GimpDrawable *drawable = NULL;
  gboolean      writable = FALSE;
  gboolean      gray     = FALSE;
  gboolean      alpha    = FALSE;

  image = action_data_get_image (data);

  if (image)
    {
      drawable = gimp_image_get_active_drawable (image);

      if (drawable)
        {
          GimpItem *item;

          alpha = gimp_drawable_has_alpha (drawable);
          gray  = gimp_drawable_is_gray (drawable);

          if (GIMP_IS_LAYER_MASK (drawable))
            item = GIMP_ITEM (gimp_layer_mask_get_layer (GIMP_LAYER_MASK (drawable)));
          else
            item = GIMP_ITEM (drawable);

          writable = ! gimp_item_is_content_locked (item);

          if (gimp_viewable_get_children (GIMP_VIEWABLE (drawable)))
            writable = FALSE;
        }
    }

#define SET_SENSITIVE(action,condition) \
        gimp_action_group_set_action_sensitive (group, action, (condition) != 0)

  SET_SENSITIVE ("filters-alien-map",               writable);
  SET_SENSITIVE ("filters-antialias",               writable);
  SET_SENSITIVE ("filters-apply-canvas",            writable);
  SET_SENSITIVE ("filters-apply-lens",              writable);
  SET_SENSITIVE ("filters-bump-map",                writable);
  SET_SENSITIVE ("filters-c2g",                     writable && !gray);
  SET_SENSITIVE ("filters-cartoon",                 writable);
  SET_SENSITIVE ("filters-channel-mixer",           writable);
  SET_SENSITIVE ("filters-checkerboard",            writable);
  SET_SENSITIVE ("filters-color-enhance",           writable && !gray);
  SET_SENSITIVE ("filters-color-exchange",          writable);
  SET_SENSITIVE ("filters-color-reduction",         writable);
  SET_SENSITIVE ("filters-color-rotate",            writable);
  SET_SENSITIVE ("filters-color-temperature",       writable && !gray);
  SET_SENSITIVE ("filters-color-to-alpha",          writable && !gray && alpha);
  SET_SENSITIVE ("filters-convolution-matrix",      writable);
  SET_SENSITIVE ("filters-cubism",                  writable);
  SET_SENSITIVE ("filters-deinterlace",             writable);
  SET_SENSITIVE ("filters-desaturate",              writable && !gray);
  SET_SENSITIVE ("filters-difference-of-gaussians", writable);
  SET_SENSITIVE ("filters-diffraction-patterns",    writable);
  SET_SENSITIVE ("filters-displace",                writable);
  SET_SENSITIVE ("filters-distance-map",            writable);
  SET_SENSITIVE ("filters-dropshadow",              writable && alpha);
  SET_SENSITIVE ("filters-edge",                    writable);
  SET_SENSITIVE ("filters-edge-laplace",            writable);
  SET_SENSITIVE ("filters-edge-sobel",              writable);
  SET_SENSITIVE ("filters-emboss",                  writable);
  SET_SENSITIVE ("filters-engrave",                 writable);
  SET_SENSITIVE ("filters-exposure",                writable);
  SET_SENSITIVE ("filters-fractal-trace",           writable);
  SET_SENSITIVE ("filters-gaussian-blur",           writable);
  SET_SENSITIVE ("filters-gaussian-blur-selective", writable);
  SET_SENSITIVE ("filters-gegl-graph",              writable);
  SET_SENSITIVE ("filters-grid",                    writable);
  SET_SENSITIVE ("filters-high-pass",               writable);
  SET_SENSITIVE ("filters-illusion",                writable);
  SET_SENSITIVE ("filters-kaleidoscope",            writable);
  SET_SENSITIVE ("filters-lens-distortion",         writable);
  SET_SENSITIVE ("filters-lens-flare",              writable);
  SET_SENSITIVE ("filters-maze",                    writable);
  SET_SENSITIVE ("filters-mono-mixer",              writable && !gray);
  SET_SENSITIVE ("filters-mosaic",                  writable);
  SET_SENSITIVE ("filters-motion-blur-circular",    writable);
  SET_SENSITIVE ("filters-motion-blur-linear",      writable);
  SET_SENSITIVE ("filters-motion-blur-zoom",        writable);
  SET_SENSITIVE ("filters-noise-cell",              writable);
  SET_SENSITIVE ("filters-noise-cie-lch",           writable);
  SET_SENSITIVE ("filters-noise-hsv",               writable && !gray);
  SET_SENSITIVE ("filters-noise-hurl",              writable);
  SET_SENSITIVE ("filters-noise-perlin",            writable);
  SET_SENSITIVE ("filters-noise-pick",              writable);
  SET_SENSITIVE ("filters-noise-reduction",         writable);
  SET_SENSITIVE ("filters-noise-rgb",               writable);
  SET_SENSITIVE ("filters-noise-simplex",           writable);
  SET_SENSITIVE ("filters-noise-slur",              writable);
  SET_SENSITIVE ("filters-noise-solid",             writable);
  SET_SENSITIVE ("filters-noise-spread",            writable);
  SET_SENSITIVE ("filters-oilify",                  writable);
  SET_SENSITIVE ("filters-panorama-projection",     writable);
  SET_SENSITIVE ("filters-photocopy",               writable);
  SET_SENSITIVE ("filters-pixelize",                writable);
  SET_SENSITIVE ("filters-plasma",                  writable);
  SET_SENSITIVE ("filters-polar-coordinates",       writable);
  SET_SENSITIVE ("filters-posterize",               writable);
  SET_SENSITIVE ("filters-red-eye-removal",         writable && !gray);
  SET_SENSITIVE ("filters-ripple",                  writable);
  SET_SENSITIVE ("filters-saturation",              writable && !gray);
  SET_SENSITIVE ("filters-semi-flatten",            writable && alpha);
  SET_SENSITIVE ("filters-sepia",                   writable && !gray);
  SET_SENSITIVE ("filters-shift",                   writable);
  SET_SENSITIVE ("filters-sinus",                   writable);
  SET_SENSITIVE ("filters-softglow",                writable);
  SET_SENSITIVE ("filters-stretch-contrast",        writable);
  SET_SENSITIVE ("filters-stretch-contrast-hsv",    writable);
  SET_SENSITIVE ("filters-supernova",               writable);
  SET_SENSITIVE ("filters-threshold-alpha",         writable && alpha);
  SET_SENSITIVE ("filters-tile-glass",              writable);
  SET_SENSITIVE ("filters-tile-paper",              writable);
  SET_SENSITIVE ("filters-tile-seamless",           writable);
  SET_SENSITIVE ("filters-unsharp-mask",            writable);
  SET_SENSITIVE ("filters-value-propagate",         writable);
  SET_SENSITIVE ("filters-video-degradation",       writable);
  SET_SENSITIVE ("filters-vignette",                writable);
  SET_SENSITIVE ("filters-waves",                   writable);
  SET_SENSITIVE ("filters-whirl-pinch",             writable);
  SET_SENSITIVE ("filters-wind",                    writable);

#undef SET_SENSITIVE

  {
    GimpProcedure *proc = gimp_filter_history_nth (group->gimp, 0);
    gint           i;

    if (proc && gimp_procedure_get_sensitive (proc, GIMP_OBJECT (drawable)))
      {
        gimp_action_group_set_action_sensitive (group, "filters-repeat", TRUE);
        gimp_action_group_set_action_sensitive (group, "filters-reshow", TRUE);
      }
    else
      {
        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 (group->gimp); i++)
      {
        gchar    *name = g_strdup_printf ("filter-recent-%02d", i + 1);
        gboolean  sensitive;

        proc = gimp_filter_history_nth (group->gimp, i);

        sensitive = gimp_procedure_get_sensitive (proc, GIMP_OBJECT (drawable));

        gimp_action_group_set_action_sensitive (group, name, sensitive);

        g_free (name);
      }
  }
}
コード例 #8
0
ファイル: file-commands.c プロジェクト: Amerekanets/gimp
void
file_save_cmd_callback (GtkAction *action,
                        gint       value,
                        gpointer   data)
{
  GimpDisplay  *display;
  GimpImage    *image;
  GtkWidget    *widget;
  GimpSaveMode  save_mode;
  gboolean      saved = FALSE;
  return_if_no_display (display, data);
  return_if_no_widget (widget, data);

  image = display->image;

  save_mode = (GimpSaveMode) value;

  if (! gimp_image_get_active_drawable (image))
    return;

  switch (save_mode)
    {
    case GIMP_SAVE_MODE_SAVE:
    case GIMP_SAVE_MODE_SAVE_AND_CLOSE:
      /*  Only save if the image has been modified  */
      if (image->dirty ||
          ! GIMP_GUI_CONFIG (image->gimp->config)->trust_dirty_flag)
        {
          const gchar         *uri;
          GimpPlugInProcedure *save_proc = NULL;

          uri       = gimp_object_get_name (GIMP_OBJECT (image));
          save_proc = gimp_image_get_save_proc (image);

          if (uri && ! save_proc)
            save_proc =
              file_procedure_find (image->gimp->plug_in_manager->save_procs,
                                   uri, NULL);

          if (uri && save_proc)
            {
              GimpPDBStatusType  status;
              GError            *error = NULL;
              GList             *list;

              for (list = gimp_action_groups_from_name ("file");
                   list;
                   list = g_list_next (list))
                {
                  gimp_action_group_set_action_sensitive (list->data,
                                                          "file-quit",
                                                          FALSE);
                }

              status = file_save (image, action_data_get_context (data),
                                  GIMP_PROGRESS (display),
                                  uri, save_proc,
                                  GIMP_RUN_WITH_LAST_VALS, FALSE, &error);

              switch (status)
                {
                case GIMP_PDB_SUCCESS:
                  saved = TRUE;
                  break;

                case GIMP_PDB_CANCEL:
                  gimp_message (image->gimp, G_OBJECT (display),
                                GIMP_MESSAGE_INFO,
                                _("Saving canceled"));
                  break;

                default:
                  {
                    gchar *filename = file_utils_uri_display_name (uri);

                    gimp_message (image->gimp, G_OBJECT (display),
                                  GIMP_MESSAGE_ERROR,
                                  _("Saving '%s' failed:\n\n%s"),
                                  filename, error->message);
                    g_free (filename);
                    g_clear_error (&error);
                  }
                  break;
                }

              for (list = gimp_action_groups_from_name ("file");
                   list;
                   list = g_list_next (list))
                {
                  gimp_action_group_set_action_sensitive (list->data,
                                                          "file-quit",
                                                          TRUE);
                }

              break;
            }

          /* fall thru */
        }
      else
        {
          saved = TRUE;
          break;
        }

    case GIMP_SAVE_MODE_SAVE_AS:
      file_save_dialog_show (display->image, widget,
                             _("Save Image"), FALSE,
                             save_mode == GIMP_SAVE_MODE_SAVE_AND_CLOSE);
      break;

    case GIMP_SAVE_MODE_SAVE_A_COPY:
      file_save_dialog_show (display->image, widget,
                             _("Save a Copy of the Image"), TRUE,
                             FALSE);
      break;
    }

  if (save_mode == GIMP_SAVE_MODE_SAVE_AND_CLOSE &&
      saved && ! display->image->dirty)
    {
      gimp_display_delete (display);
    }
}