gimp r25339 - in trunk: . app/pdb



Author: neo
Date: Wed Apr  2 21:35:53 2008
New Revision: 25339
URL: http://svn.gnome.org/viewvc/gimp?rev=25339&view=rev

Log:
2008-04-02  Sven Neumann  <sven gimp org>

	* app/pdb/gimppdb-utils.[ch]: added 
gimp_pdb_layer_is_text_layer().



Modified:
   trunk/ChangeLog
   trunk/app/pdb/gimppdb-utils.c
   trunk/app/pdb/gimppdb-utils.h

Modified: trunk/app/pdb/gimppdb-utils.c
==============================================================================
--- trunk/app/pdb/gimppdb-utils.c	(original)
+++ trunk/app/pdb/gimppdb-utils.c	Wed Apr  2 21:35:53 2008
@@ -28,8 +28,11 @@
 #include "core/gimpbrushgenerated.h"
 #include "core/gimpcontainer.h"
 #include "core/gimpdatafactory.h"
+#include "core/gimpdrawable.h"
 #include "core/gimpitem.h"
 
+#include "text/gimptextlayer.h"
+
 #include "vectors/gimpvectors.h"
 
 #include "gimppdb-utils.h"
@@ -298,7 +301,7 @@
   if (! gimp_item_is_attached (item))
     {
       g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_CALLING_ERROR,
-                   _("Item '%s' (%d) cannot be used because it has not "
+                   _("Item '%s' (%d) can not be used because it has not "
                      "been added to an image"),
                    gimp_object_get_name (GIMP_OBJECT (item)),
                    gimp_item_get_ID (item));
@@ -309,6 +312,28 @@
   return TRUE;
 }
 
+gboolean
+gimp_pdb_layer_is_text_layer (GimpLayer  *layer,
+                              GError    **error)
+{
+  g_return_val_if_fail (GIMP_IS_LAYER (layer), FALSE);
+  g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+  if (! gimp_drawable_is_text_layer (GIMP_DRAWABLE (layer)))
+    {
+      g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_CALLING_ERROR,
+                   _("Layer '%s' (%d) can not be used because it is not "
+                     "a text layer"),
+                   gimp_object_get_name (GIMP_OBJECT (layer)),
+                   gimp_item_get_ID (GIMP_ITEM (layer)));
+
+      return FALSE;
+    }
+
+  return gimp_pdb_item_is_attached (GIMP_ITEM (layer), error);
+}
+
+
 GimpStroke *
 gimp_pdb_get_vectors_stroke (GimpVectors  *vectors,
                              gint          stroke_ID,

Modified: trunk/app/pdb/gimppdb-utils.h
==============================================================================
--- trunk/app/pdb/gimppdb-utils.h	(original)
+++ trunk/app/pdb/gimppdb-utils.h	Wed Apr  2 21:35:53 2008
@@ -20,41 +20,43 @@
 #define __GIMP_PDB_UTILS_H__
 
 
-GimpBrush     * gimp_pdb_get_brush           (Gimp         *gimp,
-                                              const gchar  *name,
-                                              gboolean      writable,
-                                              GError      **error);
-GimpBrush     * gimp_pdb_get_generated_brush (Gimp         *gimp,
-                                              const gchar  *name,
-                                              gboolean      writable,
-                                              GError      **error);
-GimpPattern   * gimp_pdb_get_pattern         (Gimp         *gimp,
-                                              const gchar  *name,
-                                              GError      **error);
-GimpGradient  * gimp_pdb_get_gradient        (Gimp         *gimp,
-                                              const gchar  *name,
-                                              gboolean      writable,
-                                              GError      **error);
-GimpPalette   * gimp_pdb_get_palette         (Gimp         *gimp,
-                                              const gchar  *name,
-                                              gboolean      writable,
-                                              GError      **error);
-GimpFont      * gimp_pdb_get_font            (Gimp         *gimp,
-                                              const gchar  *name,
-                                              GError      **error);
-GimpBuffer    * gimp_pdb_get_buffer          (Gimp         *gimp,
-                                              const gchar  *name,
-                                              GError      **error);
-GimpPaintInfo * gimp_pdb_get_paint_info      (Gimp         *gimp,
-                                              const gchar  *name,
-                                              GError      **error);
-
-gboolean        gimp_pdb_item_is_attached    (GimpItem     *item,
-                                              GError      **error);
-
-GimpStroke    * gimp_pdb_get_vectors_stroke  (GimpVectors  *vectors,
-                                              gint          stroke_ID,
-                                              GError      **error);
+GimpBrush     * gimp_pdb_get_brush           (Gimp          *gimp,
+                                              const gchar   *name,
+                                              gboolean       writable,
+                                              GError       **error);
+GimpBrush     * gimp_pdb_get_generated_brush (Gimp          *gimp,
+                                              const gchar   *name,
+                                              gboolean       writable,
+                                              GError       **error);
+GimpPattern   * gimp_pdb_get_pattern         (Gimp          *gimp,
+                                              const gchar   *name,
+                                              GError       **error);
+GimpGradient  * gimp_pdb_get_gradient        (Gimp          *gimp,
+                                              const gchar   *name,
+                                              gboolean       writable,
+                                              GError       **error);
+GimpPalette   * gimp_pdb_get_palette         (Gimp          *gimp,
+                                              const gchar   *name,
+                                              gboolean       writable,
+                                              GError       **error);
+GimpFont      * gimp_pdb_get_font            (Gimp          *gimp,
+                                              const gchar   *name,
+                                              GError       **error);
+GimpBuffer    * gimp_pdb_get_buffer          (Gimp          *gimp,
+                                              const gchar   *name,
+                                              GError       **error);
+GimpPaintInfo * gimp_pdb_get_paint_info      (Gimp          *gimp,
+                                              const gchar   *name,
+                                              GError       **error);
+
+gboolean        gimp_pdb_item_is_attached    (GimpItem      *item,
+                                              GError       **error);
+gboolean        gimp_pdb_layer_is_text_layer (GimpLayer     *layer,
+                                              GError       **error);
+
+GimpStroke    * gimp_pdb_get_vectors_stroke  (GimpVectors   *vectors,
+                                              gint           stroke_ID,
+                                              GError       **error);
 
 
 #endif /* __GIMP_PDB_UTILS_H__ */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]