home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 February / CMCD0205.ISO / Linux / gimp-2.2.0.tar.gz / gimp-2.2.0.tar / gimp-2.2.0 / libgimpwidgets / gimpwidgets-private.c < prev    next >
C/C++ Source or Header  |  2003-11-15  |  3KB  |  91 lines

  1. /* LIBGIMP - The GIMP Library
  2.  * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
  3.  *
  4.  * gimpwidgets-private.c
  5.  * Copyright (C) 2003 Sven Neumann <sven@gimp.org>
  6.  *
  7.  * This library is free software; you can redistribute it and/or
  8.  * modify it under the terms of the GNU Lesser General Public
  9.  * License as published by the Free Software Foundation; either
  10.  * version 2 of the License, or (at your option) any later version.
  11.  *
  12.  * This library is distributed in the hope that it will be useful,
  13.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.  * Lesser General Public License for more details.
  16.  *
  17.  * You should have received a copy of the GNU Lesser General Public
  18.  * License along with this library; if not, write to the
  19.  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  20.  * Boston, MA 02111-1307, USA.
  21.  */
  22.  
  23. #include "config.h"
  24.  
  25. #include <gtk/gtk.h>
  26.  
  27. #include "libgimpbase/gimpbase.h"
  28.  
  29. #include "gimpwidgetstypes.h"
  30.  
  31. #include "gimphelpui.h"
  32. #include "gimpstock.h"
  33. #include "gimpwidgets-private.h"
  34.  
  35. #include "themes/Default/images/gimp-wilber-pixbufs.h"
  36.  
  37.  
  38. GimpHelpFunc          _gimp_standard_help_func  = NULL;
  39. GimpGetColorFunc      _gimp_get_foreground_func = NULL;
  40. GimpGetColorFunc      _gimp_get_background_func = NULL;
  41. GimpEnsureModulesFunc _gimp_ensure_modules_func = NULL;
  42.  
  43.  
  44. void
  45. gimp_widgets_init (GimpHelpFunc          standard_help_func,
  46.                    GimpGetColorFunc      get_foreground_func,
  47.                    GimpGetColorFunc      get_background_func,
  48.                    GimpEnsureModulesFunc ensure_modules_func)
  49. {
  50.   static gboolean  gimp_widgets_initialized = FALSE;
  51.  
  52.   GdkPixbuf *pixbuf;
  53.   GList     *icon_list = NULL;
  54.   gint       i;
  55.  
  56.   const guint8 *inline_pixbufs[] =
  57.   {
  58.     stock_wilber_16,
  59.     stock_wilber_32,
  60.     stock_wilber_48,
  61.     stock_wilber_64
  62.   };
  63.  
  64.   g_return_if_fail (standard_help_func != NULL);
  65.  
  66.   if (gimp_widgets_initialized)
  67.     g_error ("gimp_widgets_init() must only be called once!");
  68.  
  69.   _gimp_standard_help_func  = standard_help_func;
  70.   _gimp_get_foreground_func = get_foreground_func;
  71.   _gimp_get_background_func = get_background_func;
  72.   _gimp_ensure_modules_func = ensure_modules_func;
  73.  
  74.   gimp_stock_init ();
  75.  
  76.   for (i = 0; i < G_N_ELEMENTS (inline_pixbufs); i++)
  77.     {
  78.       pixbuf = gdk_pixbuf_new_from_inline (-1, inline_pixbufs[i], FALSE, NULL);
  79.       icon_list = g_list_prepend (icon_list, pixbuf);
  80.     }
  81.  
  82.   gtk_window_set_default_icon_list (icon_list);
  83.  
  84.   g_list_foreach (icon_list, (GFunc) g_object_unref, NULL);
  85.   g_list_free (icon_list);
  86.  
  87.   _gimp_help_init ();
  88.  
  89.   gimp_widgets_initialized = TRUE;
  90. }
  91.