~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to plug-ins/common/header.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-05-02 16:33:03 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070502163303-bvzhjzbpw8qglc4y
Tags: 2.3.16-1ubuntu1
* Resynchronized with Debian, remaining Ubuntu changes:
  - debian/rules: i18n magic.
* debian/control.in:
  - Maintainer: Ubuntu Core Developers <ubuntu-devel@lists.ubuntu.com>
* debian/patches/02_help-message.patch,
  debian/patches/03_gimp.desktop.in.in.patch,
  debian/patches/10_dont_show_wizard.patch: updated.
* debian/patches/04_composite-signedness.patch,
  debian/patches/05_add-letter-spacing.patch: dropped, used upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* The GIMP -- an image manipulation program
 
1
/* GIMP - The GNU Image Manipulation Program
2
2
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
3
3
 *
4
4
 * This program is free software; you can redistribute it and/or modify
18
18
 
19
19
#include "config.h"
20
20
 
21
 
#include <stdlib.h>
22
21
#include <string.h>
23
 
#include <stdio.h>
24
22
 
25
 
#include <gtk/gtk.h>
 
23
#include <glib/gstdio.h>
26
24
 
27
25
#include <libgimp/gimp.h>
28
26
#include <libgimp/gimpui.h>
30
28
#include "libgimp/stdplugins-intl.h"
31
29
 
32
30
 
 
31
#define SAVE_PROC      "file-header-save"
 
32
#define PLUG_IN_BINARY "header"
 
33
 
 
34
 
33
35
/* Declare some local functions.
34
36
 */
35
37
static void   query      (void);
43
45
                          gint32            drawable_ID);
44
46
 
45
47
 
46
 
GimpPlugInInfo PLUG_IN_INFO =
 
48
const GimpPlugInInfo PLUG_IN_INFO =
47
49
{
48
50
  NULL,  /* init_proc  */
49
51
  NULL,  /* quit_proc  */
57
59
static void
58
60
query (void)
59
61
{
60
 
  static GimpParamDef save_args[] =
 
62
  static const GimpParamDef save_args[] =
61
63
  {
62
 
    { GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
63
 
    { GIMP_PDB_IMAGE, "image", "Input image" },
64
 
    { GIMP_PDB_DRAWABLE, "drawable", "Drawable to save" },
65
 
    { GIMP_PDB_STRING, "filename", "The name of the file to save the image in" },
66
 
    { GIMP_PDB_STRING, "raw_filename", "The name of the file to save the image in" }
 
64
    { GIMP_PDB_INT32,    "run-mode",     "Interactive, non-interactive" },
 
65
    { GIMP_PDB_IMAGE,    "image",        "Input image" },
 
66
    { GIMP_PDB_DRAWABLE, "drawable",     "Drawable to save" },
 
67
    { GIMP_PDB_STRING,   "filename",     "The name of the file to save the image in" },
 
68
    { GIMP_PDB_STRING,   "raw-filename", "The name of the file to save the image in" }
67
69
  };
68
70
 
69
 
  gimp_install_procedure ("file_header_save",
 
71
  gimp_install_procedure (SAVE_PROC,
70
72
                          "saves files as C unsigned character array",
71
73
                          "FIXME: write help",
72
74
                          "Spencer Kimball & Peter Mattis",
78
80
                          G_N_ELEMENTS (save_args), 0,
79
81
                          save_args, NULL);
80
82
 
81
 
  gimp_register_file_handler_mime ("file_header_save", "text/x-chdr");
82
 
  gimp_register_save_handler ("file_header_save", "h", "");
 
83
  gimp_register_file_handler_mime (SAVE_PROC, "text/x-chdr");
 
84
  gimp_register_save_handler (SAVE_PROC, "h", "");
83
85
}
84
86
 
85
87
static void
105
107
  values[0].type          = GIMP_PDB_STATUS;
106
108
  values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR;
107
109
 
108
 
  if (strcmp (name, "file_header_save") == 0)
 
110
  if (strcmp (name, SAVE_PROC) == 0)
109
111
    {
110
112
      image_ID    = param[1].data.d_int32;
111
113
      drawable_ID = param[2].data.d_int32;
115
117
        {
116
118
        case GIMP_RUN_INTERACTIVE:
117
119
        case GIMP_RUN_WITH_LAST_VALS:
118
 
          gimp_ui_init ("header", FALSE);
 
120
          gimp_ui_init (PLUG_IN_BINARY, FALSE);
119
121
          export = gimp_export_image (&image_ID, &drawable_ID, "Header",
120
122
                                      (GIMP_EXPORT_CAN_HANDLE_RGB |
121
123
                                       GIMP_EXPORT_CAN_HANDLE_INDEXED));
164
166
  guchar *cmap;
165
167
  gint colors;
166
168
 
167
 
  if ((fp = fopen (filename, "w")) == NULL)
 
169
  if ((fp = g_fopen (filename, "w")) == NULL)
168
170
    return FALSE;
169
171
 
170
172
  drawable = gimp_drawable_get (drawable_ID);