[gimp] libgimp: move the GimpProcedure icon API next to the menu API
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] libgimp: move the GimpProcedure icon API next to the menu API
- Date: Sun, 18 Aug 2019 12:07:35 +0000 (UTC)
commit d7e42b28e3e7ac9d4febec61fdb7242bb47452a5
Author: Michael Natterer <mitch gimp org>
Date: Sun Aug 18 14:04:45 2019 +0200
libgimp: move the GimpProcedure icon API next to the menu API
libgimp/gimpprocedure.c | 302 ++++++++++++++++++++++++------------------------
libgimp/gimpprocedure.h | 24 ++--
2 files changed, 163 insertions(+), 163 deletions(-)
---
diff --git a/libgimp/gimpprocedure.c b/libgimp/gimpprocedure.c
index d36e4c4fd8..4443881463 100644
--- a/libgimp/gimpprocedure.c
+++ b/libgimp/gimpprocedure.c
@@ -60,6 +60,9 @@ struct _GimpProcedurePrivate
gchar *menu_label;
GList *menu_paths;
+ GimpIconType icon_type;
+ gpointer icon_data;
+
gchar *blurb;
gchar *help;
gchar *help_id;
@@ -68,9 +71,6 @@ struct _GimpProcedurePrivate
gchar *copyright;
gchar *date;
- GimpIconType icon_type;
- gpointer icon_data;
-
gint32 n_args;
GParamSpec **args;
@@ -693,6 +693,154 @@ gimp_procedure_get_menu_paths (GimpProcedure *procedure)
return procedure->priv->menu_paths;
}
+/**
+ * gimp_procedure_set_icon_name:
+ * @procedure: a #GimpProcedure.
+ * @icon_name: (nullable): an icon name.
+ *
+ * Sets the icon for @procedure to the icon referenced by @icon_name.
+ *
+ * Since: 3.0
+ */
+void
+gimp_procedure_set_icon_name (GimpProcedure *procedure,
+ const gchar *icon_name)
+{
+ g_return_if_fail (GIMP_IS_PROCEDURE (procedure));
+
+ gimp_procedure_set_icon (procedure,
+ GIMP_ICON_TYPE_ICON_NAME,
+ icon_name);
+}
+
+/**
+ * gimp_procedure_set_icon_pixbuf:
+ * @procedure: a #GimpProcedure.
+ * @pixbuf: (nullable): a #GdkPixbuf.
+ *
+ * Sets the icon for @procedure to @pixbuf.
+ *
+ * Since: 3.0
+ */
+void
+gimp_procedure_set_icon_pixbuf (GimpProcedure *procedure,
+ GdkPixbuf *pixbuf)
+{
+ g_return_if_fail (GIMP_IS_PROCEDURE (procedure));
+ g_return_if_fail (pixbuf == NULL || GDK_IS_PIXBUF (pixbuf));
+
+ gimp_procedure_set_icon (procedure,
+ GIMP_ICON_TYPE_PIXBUF,
+ pixbuf);
+}
+
+/**
+ * gimp_procedure_set_icon_file:
+ * @procedure: a #GimpProcedure.
+ * @file: (nullable): a #GFile pointing to an image file.
+ *
+ * Sets the icon for @procedure to the contents of an image file.
+ *
+ * Since: 3.0
+ */
+void
+gimp_procedure_set_icon_file (GimpProcedure *procedure,
+ GFile *file)
+{
+ g_return_if_fail (GIMP_IS_PROCEDURE (procedure));
+ g_return_if_fail (file == NULL || G_IS_FILE (file));
+
+ gimp_procedure_set_icon (procedure,
+ GIMP_ICON_TYPE_IMAGE_FILE,
+ file);
+}
+
+/**
+ * gimp_procedure_get_icon_type:
+ * @procedure: a #GimpProcedure.
+ *
+ * Gets the type of data set as @procedure's icon. Depending on the
+ * result, you can call the relevant specific function, such as
+ * gimp_procedure_get_icon_name().
+ *
+ * Returns: the #GimpIconType of @procedure's icon.
+ *
+ * Since: 3.0
+ */
+GimpIconType
+gimp_procedure_get_icon_type (GimpProcedure *procedure)
+{
+ g_return_val_if_fail (GIMP_IS_PROCEDURE (procedure), -1);
+
+ return procedure->priv->icon_type;
+}
+
+/**
+ * gimp_procedure_get_icon_name:
+ * @procedure: a #GimpProcedure.
+ *
+ * Gets the name of the icon if one was set for @procedure.
+ *
+ * Returns: (nullable): the icon name or %NULL if no icon name was set.
+ *
+ * Since: 3.0
+ */
+const gchar *
+gimp_procedure_get_icon_name (GimpProcedure *procedure)
+{
+ g_return_val_if_fail (GIMP_IS_PROCEDURE (procedure), NULL);
+
+ if (procedure->priv->icon_type == GIMP_ICON_TYPE_ICON_NAME)
+ return (const gchar *) procedure->priv->icon_data;
+
+ return NULL;
+}
+
+/**
+ * gimp_procedure_get_icon_file:
+ * @procedure: a #GimpProcedure.
+ *
+ * Gets the file of the icon if one was set for @procedure.
+ *
+ * Returns: (nullable) (transfer none): the icon #GFile or %NULL if no
+ * file was set.
+ *
+ * Since: 3.0
+ */
+GFile *
+gimp_procedure_get_icon_file (GimpProcedure *procedure)
+{
+ g_return_val_if_fail (GIMP_IS_PROCEDURE (procedure), NULL);
+
+ if (procedure->priv->icon_type == GIMP_ICON_TYPE_IMAGE_FILE)
+ return (GFile *) procedure->priv->icon_data;
+
+ return NULL;
+}
+
+/**
+ * gimp_procedure_get_icon_pixbuf:
+ * @procedure: a #GimpProcedure.
+ *
+ * Gets the #GdkPixbuf of the icon if an icon was set this way for
+ * @procedure.
+ *
+ * Returns: (nullable) (transfer none): the icon pixbuf or %NULL if no
+ * icon name was set.
+ *
+ * Since: 3.0
+ */
+GdkPixbuf *
+gimp_procedure_get_icon_pixbuf (GimpProcedure *procedure)
+{
+ g_return_val_if_fail (GIMP_IS_PROCEDURE (procedure), NULL);
+
+ if (procedure->priv->icon_type == GIMP_ICON_TYPE_PIXBUF)
+ return (GdkPixbuf *) procedure->priv->icon_data;
+
+ return NULL;
+}
+
/**
* gimp_procedure_set_documentation:
* @procedure: A #GimpProcedure.
@@ -862,154 +1010,6 @@ gimp_procedure_get_date (GimpProcedure *procedure)
return procedure->priv->date;
}
-/**
- * gimp_procedure_set_icon_name:
- * @procedure: a #GimpProcedure.
- * @icon_name: (nullable): an icon name.
- *
- * Sets the icon for @procedure to the icon referenced by @icon_name.
- *
- * Since: 3.0
- */
-void
-gimp_procedure_set_icon_name (GimpProcedure *procedure,
- const gchar *icon_name)
-{
- g_return_if_fail (GIMP_IS_PROCEDURE (procedure));
-
- gimp_procedure_set_icon (procedure,
- GIMP_ICON_TYPE_ICON_NAME,
- icon_name);
-}
-
-/**
- * gimp_procedure_set_icon_pixbuf:
- * @procedure: a #GimpProcedure.
- * @pixbuf: (nullable): a #GdkPixbuf.
- *
- * Sets the icon for @procedure to @pixbuf.
- *
- * Since: 3.0
- */
-void
-gimp_procedure_set_icon_pixbuf (GimpProcedure *procedure,
- GdkPixbuf *pixbuf)
-{
- g_return_if_fail (GIMP_IS_PROCEDURE (procedure));
- g_return_if_fail (pixbuf == NULL || GDK_IS_PIXBUF (pixbuf));
-
- gimp_procedure_set_icon (procedure,
- GIMP_ICON_TYPE_PIXBUF,
- pixbuf);
-}
-
-/**
- * gimp_procedure_set_icon_file:
- * @procedure: a #GimpProcedure.
- * @file: (nullable): a #GFile pointing to an image file.
- *
- * Sets the icon for @procedure to the contents of an image file.
- *
- * Since: 3.0
- */
-void
-gimp_procedure_set_icon_file (GimpProcedure *procedure,
- GFile *file)
-{
- g_return_if_fail (GIMP_IS_PROCEDURE (procedure));
- g_return_if_fail (file == NULL || G_IS_FILE (file));
-
- gimp_procedure_set_icon (procedure,
- GIMP_ICON_TYPE_IMAGE_FILE,
- file);
-}
-
-/**
- * gimp_procedure_get_icon_type:
- * @procedure: a #GimpProcedure.
- *
- * Gets the type of data set as @procedure's icon. Depending on the
- * result, you can call the relevant specific function, such as
- * gimp_procedure_get_icon_name().
- *
- * Returns: the #GimpIconType of @procedure's icon.
- *
- * Since: 3.0
- */
-GimpIconType
-gimp_procedure_get_icon_type (GimpProcedure *procedure)
-{
- g_return_val_if_fail (GIMP_IS_PROCEDURE (procedure), -1);
-
- return procedure->priv->icon_type;
-}
-
-/**
- * gimp_procedure_get_icon_name:
- * @procedure: a #GimpProcedure.
- *
- * Gets the name of the icon if one was set for @procedure.
- *
- * Returns: (nullable): the icon name or %NULL if no icon name was set.
- *
- * Since: 3.0
- */
-const gchar *
-gimp_procedure_get_icon_name (GimpProcedure *procedure)
-{
- g_return_val_if_fail (GIMP_IS_PROCEDURE (procedure), NULL);
-
- if (procedure->priv->icon_type == GIMP_ICON_TYPE_ICON_NAME)
- return (const gchar *) procedure->priv->icon_data;
-
- return NULL;
-}
-
-/**
- * gimp_procedure_get_icon_file:
- * @procedure: a #GimpProcedure.
- *
- * Gets the file of the icon if one was set for @procedure.
- *
- * Returns: (nullable) (transfer none): the icon #GFile or %NULL if no
- * file was set.
- *
- * Since: 3.0
- */
-GFile *
-gimp_procedure_get_icon_file (GimpProcedure *procedure)
-{
- g_return_val_if_fail (GIMP_IS_PROCEDURE (procedure), NULL);
-
- if (procedure->priv->icon_type == GIMP_ICON_TYPE_IMAGE_FILE)
- return (GFile *) procedure->priv->icon_data;
-
- return NULL;
-}
-
-/**
- * gimp_procedure_get_icon_pixbuf:
- * @procedure: a #GimpProcedure.
- *
- * Gets the #GdkPixbuf of the icon if an icon was set this way for
- * @procedure.
- *
- * Returns: (nullable) (transfer none): the icon pixbuf or %NULL if no
- * icon name was set.
- *
- * Since: 3.0
- */
-GdkPixbuf *
-gimp_procedure_get_icon_pixbuf (GimpProcedure *procedure)
-{
- g_return_val_if_fail (GIMP_IS_PROCEDURE (procedure), NULL);
-
- if (procedure->priv->icon_type == GIMP_ICON_TYPE_PIXBUF)
- return (GdkPixbuf *) procedure->priv->icon_data;
-
- return NULL;
-}
-
/**
* gimp_procedure_add_argument:
* @procedure: the #GimpProcedure.
diff --git a/libgimp/gimpprocedure.h b/libgimp/gimpprocedure.h
index 4de5c72b97..a83115fea0 100644
--- a/libgimp/gimpprocedure.h
+++ b/libgimp/gimpprocedure.h
@@ -114,6 +114,18 @@ void gimp_procedure_add_menu_path (GimpProcedure *proced
const gchar *menu_path);
GList * gimp_procedure_get_menu_paths (GimpProcedure *procedure);
+void gimp_procedure_set_icon_name (GimpProcedure *procedure,
+ const gchar *icon_name);
+void gimp_procedure_set_icon_file (GimpProcedure *procedure,
+ GFile *file);
+void gimp_procedure_set_icon_pixbuf (GimpProcedure *procedure,
+ GdkPixbuf *pixbuf);
+
+GimpIconType gimp_procedure_get_icon_type (GimpProcedure *procedure);
+const gchar * gimp_procedure_get_icon_name (GimpProcedure *procedure);
+GFile * gimp_procedure_get_icon_file (GimpProcedure *procedure);
+GdkPixbuf * gimp_procedure_get_icon_pixbuf (GimpProcedure *procedure);
+
void gimp_procedure_set_documentation (GimpProcedure *procedure,
const gchar *blurb,
const gchar *help,
@@ -130,18 +142,6 @@ const gchar * gimp_procedure_get_authors (GimpProcedure *proced
const gchar * gimp_procedure_get_copyright (GimpProcedure *procedure);
const gchar * gimp_procedure_get_date (GimpProcedure *procedure);
-void gimp_procedure_set_icon_name (GimpProcedure *procedure,
- const gchar *icon_name);
-void gimp_procedure_set_icon_file (GimpProcedure *procedure,
- GFile *file);
-void gimp_procedure_set_icon_pixbuf (GimpProcedure *procedure,
- GdkPixbuf *pixbuf);
-
-GimpIconType gimp_procedure_get_icon_type (GimpProcedure *procedure);
-const gchar * gimp_procedure_get_icon_name (GimpProcedure *procedure);
-GFile * gimp_procedure_get_icon_file (GimpProcedure *procedure);
-GdkPixbuf * gimp_procedure_get_icon_pixbuf (GimpProcedure *procedure);
-
void gimp_procedure_add_argument (GimpProcedure *procedure,
GParamSpec *pspec);
void gimp_procedure_add_argument_from_property
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]