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

« back to all changes in this revision

Viewing changes to app/pdb/message_cmds.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2008-10-06 13:30:41 UTC
  • mto: This revision was merged to the branch mainline in revision 35.
  • Revision ID: james.westby@ubuntu.com-20081006133041-3panbkcanaymfsmp
Tags: upstream-2.6.0
ImportĀ upstreamĀ versionĀ 2.6.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* GIMP - The GNU Image Manipulation Program
2
 
 * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
3
 
 *
4
 
 * This program is free software; you can redistribute it and/or modify
5
 
 * it under the terms of the GNU General Public License as published by
6
 
 * the Free Software Foundation; either version 2 of the License, or
7
 
 * (at your option) any later version.
8
 
 *
9
 
 * This program is distributed in the hope that it will be useful,
10
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 
 * GNU General Public License for more details.
13
 
 *
14
 
 * You should have received a copy of the GNU General Public License
15
 
 * along with this program; if not, write to the Free Software
16
 
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
 
 */
18
 
 
19
 
/* NOTE: This file is auto-generated by pdbgen.pl. */
20
 
 
21
 
#include "config.h"
22
 
 
23
 
#include <string.h>
24
 
 
25
 
#include <glib-object.h>
26
 
 
27
 
#include "pdb-types.h"
28
 
#include "gimppdb.h"
29
 
#include "gimpprocedure.h"
30
 
#include "core/gimpparamspecs.h"
31
 
 
32
 
#include "core/gimp.h"
33
 
#include "gimp-intl.h"
34
 
#include "plug-in/gimpplugin.h"
35
 
#include "plug-in/gimppluginmanager.h"
36
 
 
37
 
#include "internal_procs.h"
38
 
 
39
 
 
40
 
static GValueArray *
41
 
message_invoker (GimpProcedure     *procedure,
42
 
                 Gimp              *gimp,
43
 
                 GimpContext       *context,
44
 
                 GimpProgress      *progress,
45
 
                 const GValueArray *args)
46
 
{
47
 
  gboolean success = TRUE;
48
 
  const gchar *message;
49
 
 
50
 
  message = g_value_get_string (&args->values[0]);
51
 
 
52
 
  if (success)
53
 
    {
54
 
      const gchar *domain = NULL;
55
 
 
56
 
      if (gimp->plug_in_manager->current_plug_in)
57
 
        domain = gimp_plug_in_get_undo_desc (gimp->plug_in_manager->current_plug_in);
58
 
      gimp_show_message (gimp, G_OBJECT (progress), GIMP_MESSAGE_WARNING,
59
 
                         domain, message);
60
 
    }
61
 
 
62
 
  return gimp_procedure_get_return_values (procedure, success);
63
 
}
64
 
 
65
 
static GValueArray *
66
 
message_get_handler_invoker (GimpProcedure     *procedure,
67
 
                             Gimp              *gimp,
68
 
                             GimpContext       *context,
69
 
                             GimpProgress      *progress,
70
 
                             const GValueArray *args)
71
 
{
72
 
  GValueArray *return_vals;
73
 
  gint32 handler = 0;
74
 
 
75
 
  handler = gimp->message_handler;
76
 
 
77
 
  return_vals = gimp_procedure_get_return_values (procedure, TRUE);
78
 
  g_value_set_enum (&return_vals->values[1], handler);
79
 
 
80
 
  return return_vals;
81
 
}
82
 
 
83
 
static GValueArray *
84
 
message_set_handler_invoker (GimpProcedure     *procedure,
85
 
                             Gimp              *gimp,
86
 
                             GimpContext       *context,
87
 
                             GimpProgress      *progress,
88
 
                             const GValueArray *args)
89
 
{
90
 
  gboolean success = TRUE;
91
 
  gint32 handler;
92
 
 
93
 
  handler = g_value_get_enum (&args->values[0]);
94
 
 
95
 
  if (success)
96
 
    {
97
 
      gimp->message_handler = handler;
98
 
    }
99
 
 
100
 
  return gimp_procedure_get_return_values (procedure, success);
101
 
}
102
 
 
103
 
void
104
 
register_message_procs (GimpPDB *pdb)
105
 
{
106
 
  GimpProcedure *procedure;
107
 
 
108
 
  /*
109
 
   * gimp-message
110
 
   */
111
 
  procedure = gimp_procedure_new (message_invoker);
112
 
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-message");
113
 
  gimp_procedure_set_static_strings (procedure,
114
 
                                     "gimp-message",
115
 
                                     "Displays a dialog box with a message.",
116
 
                                     "Displays a dialog box with a message. Useful for status or error reporting. The message must be in UTF-8 encoding.",
117
 
                                     "Manish Singh",
118
 
                                     "Manish Singh",
119
 
                                     "1998",
120
 
                                     NULL);
121
 
  gimp_procedure_add_argument (procedure,
122
 
                               gimp_param_spec_string ("message",
123
 
                                                       "message",
124
 
                                                       "Message to display in the dialog",
125
 
                                                       FALSE, FALSE, FALSE,
126
 
                                                       NULL,
127
 
                                                       GIMP_PARAM_READWRITE));
128
 
  gimp_pdb_register_procedure (pdb, procedure);
129
 
  g_object_unref (procedure);
130
 
 
131
 
  /*
132
 
   * gimp-message-get-handler
133
 
   */
134
 
  procedure = gimp_procedure_new (message_get_handler_invoker);
135
 
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-message-get-handler");
136
 
  gimp_procedure_set_static_strings (procedure,
137
 
                                     "gimp-message-get-handler",
138
 
                                     "Returns the current state of where warning messages are displayed.",
139
 
                                     "This procedure returns the way g_message warnings are displayed. They can be shown in a dialog box or printed on the console where gimp was started.",
140
 
                                     "Manish Singh",
141
 
                                     "Manish Singh",
142
 
                                     "1998",
143
 
                                     NULL);
144
 
  gimp_procedure_add_return_value (procedure,
145
 
                                   g_param_spec_enum ("handler",
146
 
                                                      "handler",
147
 
                                                      "The current handler type",
148
 
                                                      GIMP_TYPE_MESSAGE_HANDLER_TYPE,
149
 
                                                      GIMP_MESSAGE_BOX,
150
 
                                                      GIMP_PARAM_READWRITE));
151
 
  gimp_pdb_register_procedure (pdb, procedure);
152
 
  g_object_unref (procedure);
153
 
 
154
 
  /*
155
 
   * gimp-message-set-handler
156
 
   */
157
 
  procedure = gimp_procedure_new (message_set_handler_invoker);
158
 
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-message-set-handler");
159
 
  gimp_procedure_set_static_strings (procedure,
160
 
                                     "gimp-message-set-handler",
161
 
                                     "Controls where warning messages are displayed.",
162
 
                                     "This procedure controls how g_message warnings are displayed. They can be shown in a dialog box or printed on the console where gimp was started.",
163
 
                                     "Manish Singh",
164
 
                                     "Manish Singh",
165
 
                                     "1998",
166
 
                                     NULL);
167
 
  gimp_procedure_add_argument (procedure,
168
 
                               g_param_spec_enum ("handler",
169
 
                                                  "handler",
170
 
                                                  "The new handler type",
171
 
                                                  GIMP_TYPE_MESSAGE_HANDLER_TYPE,
172
 
                                                  GIMP_MESSAGE_BOX,
173
 
                                                  GIMP_PARAM_READWRITE));
174
 
  gimp_pdb_register_procedure (pdb, procedure);
175
 
  g_object_unref (procedure);
176
 
}