~ubuntu-branches/ubuntu/hoary/gimp/hoary

« back to all changes in this revision

Viewing changes to libgimp/gimpplugin.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2005-04-04 14:51:23 UTC
  • Revision ID: james.westby@ubuntu.com-20050404145123-9py049eeelfymur8
Tags: upstream-2.2.2
ImportĀ upstreamĀ versionĀ 2.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* LIBGIMP - The GIMP Library
 
2
 * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
 
3
 *
 
4
 * gimpplugin.c
 
5
 *
 
6
 * This library is free software; you can redistribute it and/or
 
7
 * modify it under the terms of the GNU Lesser General Public
 
8
 * License as published by the Free Software Foundation; either
 
9
 * version 2 of the License, or (at your option) any later version.
 
10
 *
 
11
 * This library is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
14
 * Lesser General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU Lesser General Public
 
17
 * License along with this library; if not, write to the
 
18
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
19
 * Boston, MA 02111-1307, USA.
 
20
 */
 
21
 
 
22
#include "config.h"
 
23
 
 
24
#include <string.h>
 
25
 
 
26
#include "gimp.h"
 
27
 
 
28
gboolean
 
29
gimp_plugin_icon_register (const gchar  *procedure_name,
 
30
                           GimpIconType  icon_type,
 
31
                           const guint8 *icon_data)
 
32
{
 
33
  gint icon_data_length;
 
34
 
 
35
  g_return_val_if_fail (procedure_name != NULL, FALSE);
 
36
  g_return_val_if_fail (icon_data != NULL, FALSE);
 
37
 
 
38
  switch (icon_type)
 
39
    {
 
40
    case GIMP_ICON_TYPE_STOCK_ID:
 
41
    case GIMP_ICON_TYPE_IMAGE_FILE:
 
42
      icon_data_length = strlen (icon_data) + 1;
 
43
      break;
 
44
 
 
45
    case GIMP_ICON_TYPE_INLINE_PIXBUF:
 
46
      g_return_val_if_fail (g_ntohl (*((gint32 *) icon_data)) == 0x47646b50,
 
47
                            FALSE);
 
48
 
 
49
      icon_data_length = g_ntohl (*((gint32 *) (icon_data + 4)));
 
50
      break;
 
51
 
 
52
    default:
 
53
      g_return_val_if_reached (FALSE);
 
54
    }
 
55
 
 
56
  return _gimp_plugin_icon_register (procedure_name,
 
57
                                     icon_type, icon_data_length, icon_data);
 
58
}