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

« back to all changes in this revision

Viewing changes to app/pdb/misc_cmds.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-2003 Spencer Kimball and Peter Mattis
3
3
 *
4
4
 * This program is free software; you can redistribute it and/or modify
16
16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
17
 */
18
18
 
19
 
/* NOTE: This file is autogenerated by pdbgen.pl. */
 
19
/* NOTE: This file is auto-generated by pdbgen.pl. */
20
20
 
21
21
#include "config.h"
22
22
 
 
23
#include <glib.h>
 
24
 
 
25
#ifdef G_OS_WIN32
 
26
#include <process.h>
 
27
#endif
 
28
 
 
29
#include <sys/types.h>
 
30
 
 
31
#ifdef HAVE_UNISTD_H
 
32
#include <unistd.h>
 
33
#endif
 
34
 
23
35
 
24
36
#include <glib-object.h>
25
37
 
26
38
#include "libgimpbase/gimpbase.h"
27
39
 
28
40
#include "pdb-types.h"
29
 
#include "procedural_db.h"
 
41
#include "gimppdb.h"
 
42
#include "gimpprocedure.h"
 
43
#include "core/gimpparamspecs.h"
30
44
 
31
45
#include "core/gimp.h"
32
46
 
33
 
static ProcRecord version_proc;
34
 
static ProcRecord quit_proc;
 
47
#include "internal_procs.h"
 
48
 
 
49
 
 
50
static GValueArray *
 
51
version_invoker (GimpProcedure     *procedure,
 
52
                 Gimp              *gimp,
 
53
                 GimpContext       *context,
 
54
                 GimpProgress      *progress,
 
55
                 const GValueArray *args)
 
56
{
 
57
  GValueArray *return_vals;
 
58
  gchar *version = NULL;
 
59
 
 
60
  version = g_strdup (GIMP_VERSION);
 
61
 
 
62
  return_vals = gimp_procedure_get_return_values (procedure, TRUE);
 
63
  g_value_take_string (&return_vals->values[1], version);
 
64
 
 
65
  return return_vals;
 
66
}
 
67
 
 
68
static GValueArray *
 
69
getpid_invoker (GimpProcedure     *procedure,
 
70
                Gimp              *gimp,
 
71
                GimpContext       *context,
 
72
                GimpProgress      *progress,
 
73
                const GValueArray *args)
 
74
{
 
75
  GValueArray *return_vals;
 
76
  gint32 pid = 0;
 
77
 
 
78
  pid = getpid ();
 
79
 
 
80
  return_vals = gimp_procedure_get_return_values (procedure, TRUE);
 
81
  g_value_set_int (&return_vals->values[1], pid);
 
82
 
 
83
  return return_vals;
 
84
}
 
85
 
 
86
static GValueArray *
 
87
quit_invoker (GimpProcedure     *procedure,
 
88
              Gimp              *gimp,
 
89
              GimpContext       *context,
 
90
              GimpProgress      *progress,
 
91
              const GValueArray *args)
 
92
{
 
93
  gboolean success = TRUE;
 
94
  gboolean force;
 
95
 
 
96
  force = g_value_get_boolean (&args->values[0]);
 
97
 
 
98
  if (success)
 
99
    {
 
100
      gimp_exit (gimp, force);
 
101
    }
 
102
 
 
103
  return gimp_procedure_get_return_values (procedure, success);
 
104
}
35
105
 
36
106
void
37
 
register_misc_procs (Gimp *gimp)
38
 
{
39
 
  procedural_db_register (gimp, &version_proc);
40
 
  procedural_db_register (gimp, &quit_proc);
41
 
}
42
 
 
43
 
static Argument *
44
 
version_invoker (Gimp         *gimp,
45
 
                 GimpContext  *context,
46
 
                 GimpProgress *progress,
47
 
                 Argument     *args)
48
 
{
49
 
  Argument *return_args;
50
 
 
51
 
  return_args = procedural_db_return_args (&version_proc, TRUE);
52
 
  return_args[1].value.pdb_pointer = g_strdup (GIMP_VERSION);
53
 
 
54
 
  return return_args;
55
 
}
56
 
 
57
 
static ProcArg version_outargs[] =
58
 
{
59
 
  {
60
 
    GIMP_PDB_STRING,
61
 
    "version",
62
 
    "The gimp version"
63
 
  }
64
 
};
65
 
 
66
 
static ProcRecord version_proc =
67
 
{
68
 
  "gimp_version",
69
 
  "Returns the host gimp version.",
70
 
  "This procedure returns the version number of the currently running gimp.",
71
 
  "Manish Singh",
72
 
  "Manish Singh",
73
 
  "1999",
74
 
  NULL,
75
 
  GIMP_INTERNAL,
76
 
  0,
77
 
  NULL,
78
 
  1,
79
 
  version_outargs,
80
 
  { { version_invoker } }
81
 
};
82
 
 
83
 
static Argument *
84
 
quit_invoker (Gimp         *gimp,
85
 
              GimpContext  *context,
86
 
              GimpProgress *progress,
87
 
              Argument     *args)
88
 
{
89
 
  gboolean force;
90
 
 
91
 
  force = args[0].value.pdb_int ? TRUE : FALSE;
92
 
 
93
 
  gimp_exit (gimp, force);
94
 
 
95
 
  return procedural_db_return_args (&quit_proc, TRUE);
96
 
}
97
 
 
98
 
static ProcArg quit_inargs[] =
99
 
{
100
 
  {
101
 
    GIMP_PDB_INT32,
102
 
    "force",
103
 
    "Flag specifying whether to force the gimp to or exit normally"
104
 
  }
105
 
};
106
 
 
107
 
static ProcRecord quit_proc =
108
 
{
109
 
  "gimp_quit",
110
 
  "Causes the gimp to exit gracefully.",
111
 
  "The internal procedure which can either be used to make the gimp quit. If there are unsaved images in an interactive GIMP session, the user will be asked for confirmation. If force is TRUE, the application is quit without querying the user to save any dirty images.",
112
 
  "Spencer Kimball & Peter Mattis",
113
 
  "Spencer Kimball & Peter Mattis",
114
 
  "1995-1996",
115
 
  NULL,
116
 
  GIMP_INTERNAL,
117
 
  1,
118
 
  quit_inargs,
119
 
  0,
120
 
  NULL,
121
 
  { { quit_invoker } }
122
 
};
 
107
register_misc_procs (GimpPDB *pdb)
 
108
{
 
109
  GimpProcedure *procedure;
 
110
 
 
111
  /*
 
112
   * gimp-version
 
113
   */
 
114
  procedure = gimp_procedure_new (version_invoker);
 
115
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-version");
 
116
  gimp_procedure_set_static_strings (procedure,
 
117
                                     "gimp-version",
 
118
                                     "Returns the host GIMP version.",
 
119
                                     "This procedure returns the version number of the currently running GIMP.",
 
120
                                     "Manish Singh",
 
121
                                     "Manish Singh",
 
122
                                     "1999",
 
123
                                     NULL);
 
124
  gimp_procedure_add_return_value (procedure,
 
125
                                   gimp_param_spec_string ("version",
 
126
                                                           "version",
 
127
                                                           "GIMP version number",
 
128
                                                           FALSE, FALSE,
 
129
                                                           NULL,
 
130
                                                           GIMP_PARAM_READWRITE));
 
131
  gimp_pdb_register_procedure (pdb, procedure);
 
132
  g_object_unref (procedure);
 
133
 
 
134
  /*
 
135
   * gimp-getpid
 
136
   */
 
137
  procedure = gimp_procedure_new (getpid_invoker);
 
138
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-getpid");
 
139
  gimp_procedure_set_static_strings (procedure,
 
140
                                     "gimp-getpid",
 
141
                                     "Returns the PID of the host GIMP process.",
 
142
                                     "This procedure returns the process ID of the currently running GIMP.",
 
143
                                     "Michael Natterer <mitch@gimp.org>",
 
144
                                     "Michael Natterer",
 
145
                                     "2005",
 
146
                                     NULL);
 
147
  gimp_procedure_add_return_value (procedure,
 
148
                                   gimp_param_spec_int32 ("pid",
 
149
                                                          "pid",
 
150
                                                          "The PID",
 
151
                                                          G_MININT32, G_MAXINT32, 0,
 
152
                                                          GIMP_PARAM_READWRITE));
 
153
  gimp_pdb_register_procedure (pdb, procedure);
 
154
  g_object_unref (procedure);
 
155
 
 
156
  /*
 
157
   * gimp-quit
 
158
   */
 
159
  procedure = gimp_procedure_new (quit_invoker);
 
160
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-quit");
 
161
  gimp_procedure_set_static_strings (procedure,
 
162
                                     "gimp-quit",
 
163
                                     "Causes GIMP to exit gracefully.",
 
164
                                     "If there are unsaved images in an interactive GIMP session, the user will be asked for confirmation. If force is TRUE, the application is quit without querying the user to save any dirty images.",
 
165
                                     "Spencer Kimball & Peter Mattis",
 
166
                                     "Spencer Kimball & Peter Mattis",
 
167
                                     "1995-1996",
 
168
                                     NULL);
 
169
  gimp_procedure_add_argument (procedure,
 
170
                               g_param_spec_boolean ("force",
 
171
                                                     "force",
 
172
                                                     "Force GIMP to quit without asking",
 
173
                                                     FALSE,
 
174
                                                     GIMP_PARAM_READWRITE));
 
175
  gimp_pdb_register_procedure (pdb, procedure);
 
176
  g_object_unref (procedure);
 
177
}