Annotate libpurple constructors that return base types

Fri, 14 Feb 2025 02:12:52 -0600

author
Elliott Sales de Andrade <quantum.analyst@gmail.com>
date
Fri, 14 Feb 2025 02:12:52 -0600
changeset 43176
04f562dc0ff2
parent 43175
41ad34b9de13
child 43177
595a5f31003a

Annotate libpurple constructors that return base types

In that case, annotating the actual type will help bindings use the correct type.

Testing Done:
Compared the gir before and after:
```diff
--- Purple-3.0.gir 2025-02-14 00:51:54.467548255 -0500
+++ build/libpurple/Purple-3.0.gir 2025-02-14 02:45:56.050535272 -0500
@@ -19676,8 +19676,9 @@
<return-value transfer-ownership="full">
<doc xml:space="preserve"
filename="libpurple/purplenoopcredentialprovider.h"
- line="62">The new #PurpleNoopCredentialProvider instance.</doc>
- <type name="CredentialProvider" c:type="PurpleCredentialProvider*"/>
+ line="62">The new credential provider.</doc>
+ <type name="NoopCredentialProvider"
+ c:type="PurpleCredentialProvider*"/>
</return-value>
</constructor>
</class>
@@ -20412,7 +20413,7 @@
<doc xml:space="preserve"
filename="libpurple/purplenotificationaddcontact.h"
line="65">The new notification.</doc>
- <type name="Notification" c:type="PurpleNotification*"/>
+ <type name="NotificationAddContact" c:type="PurpleNotification*"/>
</return-value>
<parameters>
<parameter name="id"
@@ -20507,7 +20508,8 @@
<doc xml:space="preserve"
filename="libpurple/purplenotificationauthorizationrequest.h"
line="65">The new notification.</doc>
- <type name="Notification" c:type="PurpleNotification*"/>
+ <type name="NotificationAuthorizationRequest"
+ c:type="PurpleNotification*"/>
</return-value>
<parameters>
<parameter name="id"
@@ -20608,11 +20610,12 @@
line="55">Creates a new [class@Notification] for a connection error on @account.</doc>
<source-position filename="libpurple/purplenotificationconnectionerror.h"
line="67"/>
- <return-value transfer-ownership="full" nullable="1">
+ <return-value transfer-ownership="full">
<doc xml:space="preserve"
filename="libpurple/purplenotificationconnectionerror.h"
line="62">The new notification.</doc>
- <type name="Notification" c:type="PurpleNotification*"/>
+ <type name="NotificationConnectionError"
+ c:type="PurpleNotification*"/>
</return-value>
<parameters>
<parameter name="id"
@@ -20668,7 +20671,7 @@
<doc xml:space="preserve"
filename="libpurple/purplenotificationlink.h"
line="61">The new notification.</doc>
- <type name="Notification" c:type="PurpleNotification*"/>
+ <type name="NotificationLink" c:type="PurpleNotification*"/>
</return-value>
<parameters>
<parameter name="id"
@@ -21881,8 +21884,8 @@
<return-value transfer-ownership="full">
<doc xml:space="preserve"
filename="libpurple/purpleplugininfo.h"
- line="207">A new #PurplePluginInfo instance.</doc>
- <type name="GPlugin.PluginInfo" c:type="GPluginPluginInfo*"/>
+ line="207">The new plugin info.</doc>
+ <type name="PluginInfo" c:type="GPluginPluginInfo*"/>
</return-value>
<parameters>
<parameter name="first_property" transfer-ownership="none">
@@ -31364,7 +31367,7 @@
<doc xml:space="preserve"
filename="libpurple/request/purplerequestfieldaccount.h"
line="79">The new field.</doc>
- <type name="RequestField" c:type="PurpleRequestField*"/>
+ <type name="RequestFieldAccount" c:type="PurpleRequestField*"/>
</return-value>
<parameters>
<parameter name="id" transfer-ownership="none">
@@ -31737,7 +31740,7 @@
<doc xml:space="preserve"
filename="libpurple/request/purplerequestfieldbool.h"
line="61">The new field.</doc>
- <type name="RequestField" c:type="PurpleRequestField*"/>
+ <type name="RequestFieldBool" c:type="PurpleRequestField*"/>
</return-value>
<parameters>
<parameter name="id" transfer-ownership="none">
@@ -31918,7 +31921,7 @@
<doc xml:space="preserve"
filename="libpurple/request/purplerequestfieldchoice.h"
line="61">The new field.</doc>
- <type name="RequestField" c:type="PurpleRequestField*"/>
+ <type name="RequestFieldChoice" c:type="PurpleRequestField*"/>
</return-value>
<parameters>
<parameter name="id" transfer-ownership="none">
@@ -32281,7 +32284,7 @@
<doc xml:space="preserve"
filename="libpurple/request/purplerequestfieldimage.h"
line="63">The new field.</doc>
- <type name="RequestField" c:type="PurpleRequestField*"/>
+ <type name="RequestFieldImage" c:type="PurpleRequestField*"/>
</return-value>
<parameters>
<parameter name="id" transfer-ownership="none">
@@ -32508,7 +32511,7 @@
<doc xml:space="preserve"
filename="libpurple/request/purplerequestfieldint.h"
line="61">The new field.</doc>
- <type name="RequestField" c:type="PurpleRequestField*"/>
+ <type name="RequestFieldInt" c:type="PurpleRequestField*"/>
</return-value>
<parameters>
<parameter name="id" transfer-ownership="none">
@@ -32825,7 +32828,7 @@
<doc xml:space="preserve"
filename="libpurple/request/purplerequestfieldlabel.h"
line="58">The new field.</doc>
- <type name="RequestField" c:type="PurpleRequestField*"/>
+ <type name="RequestFieldLabel" c:type="PurpleRequestField*"/>
</return-value>
<parameters>
<parameter name="id" transfer-ownership="none">
@@ -32876,7 +32879,7 @@
<doc xml:space="preserve"
filename="libpurple/request/purplerequestfieldlist.h"
line="58">The new field.</doc>
- <type name="RequestField" c:type="PurpleRequestField*"/>
+ <type name="RequestFieldList" c:type="PurpleRequestField*"/>
</return-value>
<parameters>
<parameter name="id" transfer-ownership="none">
@@ -33230,7 +33233,7 @@
<doc xml:space="preserve"
filename="libpurple/request/purplerequestfieldstring.h"
line="60">The new field.</doc>
- <type name="RequestField" c:type="PurpleRequestField*"/>
+ <type name="RequestFieldString" c:type="PurpleRequestField*"/>
</return-value>
<parameters>
<parameter name="id" transfer-ownership="none">
@@ -35252,8 +35255,8 @@
<return-value transfer-ownership="full">
<doc xml:space="preserve"
filename="libpurple/purplesqlitehistoryadapter.h"
- line="60">The new #PurpleSqliteHistoryAdapter instance.</doc>
- <type name="HistoryAdapter" c:type="PurpleHistoryAdapter*"/>
+ line="60">The new history adapter.</doc>
+ <type name="SqliteHistoryAdapter" c:type="PurpleHistoryAdapter*"/>
</return-value>
<parameters>
<parameter name="filename" transfer-ownership="none">
```

Reviewed at https://reviews.imfreedom.org/r/3837/

libpurple/purplenoopcredentialprovider.h file | annotate | diff | comparison | revisions
libpurple/purplenotificationaddcontact.h file | annotate | diff | comparison | revisions
libpurple/purplenotificationauthorizationrequest.h file | annotate | diff | comparison | revisions
libpurple/purplenotificationconnectionerror.h file | annotate | diff | comparison | revisions
libpurple/purplenotificationlink.h file | annotate | diff | comparison | revisions
libpurple/purpleplugininfo.h file | annotate | diff | comparison | revisions
libpurple/purplesqlitehistoryadapter.h file | annotate | diff | comparison | revisions
libpurple/request/purplerequestfieldaccount.h file | annotate | diff | comparison | revisions
libpurple/request/purplerequestfieldbool.h file | annotate | diff | comparison | revisions
libpurple/request/purplerequestfieldchoice.h file | annotate | diff | comparison | revisions
libpurple/request/purplerequestfieldimage.h file | annotate | diff | comparison | revisions
libpurple/request/purplerequestfieldint.h file | annotate | diff | comparison | revisions
libpurple/request/purplerequestfieldlabel.h file | annotate | diff | comparison | revisions
libpurple/request/purplerequestfieldlist.h file | annotate | diff | comparison | revisions
libpurple/request/purplerequestfieldstring.h file | annotate | diff | comparison | revisions
--- a/libpurple/purplenoopcredentialprovider.h	Fri Feb 07 00:14:03 2025 -0600
+++ b/libpurple/purplenoopcredentialprovider.h	Fri Feb 14 02:12:52 2025 -0600
@@ -59,7 +59,8 @@
  * not need to call this directly as #PurpleCredentialManager will create one
  * for itself.
  *
- * Returns: (transfer full): The new #PurpleNoopCredentialProvider instance.
+ * Returns: (transfer full) (type PurpleNoopCredentialProvider): The new
+ *          credential provider.
  *
  * Since: 3.0
  */
--- a/libpurple/purplenotificationaddcontact.h	Fri Feb 07 00:14:03 2025 -0600
+++ b/libpurple/purplenotificationaddcontact.h	Fri Feb 14 02:12:52 2025 -0600
@@ -62,7 +62,8 @@
  * Since @request has a [class@Contact] which has a [class@Account],
  * [property@Notification:account] will automatically be set to that.
  *
- * Returns: The new notification.
+ * Returns: (transfer full) (type PurpleNotificationAddContact): The new
+ *          notification.
  *
  * Since: 3.0
  */
--- a/libpurple/purplenotificationauthorizationrequest.h	Fri Feb 07 00:14:03 2025 -0600
+++ b/libpurple/purplenotificationauthorizationrequest.h	Fri Feb 14 02:12:52 2025 -0600
@@ -62,7 +62,8 @@
  * Since [class@AuthorizationRequest] has a [class@Account],
  * [property@Notification:account] will automatically be set to that.
  *
- * Returns: The new notification.
+ * Returns: (transfer full) (type PurpleNotificationAuthorizationRequest): The
+ *          new notification.
  *
  * Since: 3.0
  */
--- a/libpurple/purplenotificationconnectionerror.h	Fri Feb 07 00:14:03 2025 -0600
+++ b/libpurple/purplenotificationconnectionerror.h	Fri Feb 14 02:12:52 2025 -0600
@@ -59,7 +59,8 @@
  *
  * Creates a new [class@Notification] for a connection error on @account.
  *
- * Returns: (nullable): The new notification.
+ * Returns: (transfer full) (type PurpleNotificationConnectionError): The new
+ *          notification.
  *
  * Since: 3.0
  */
--- a/libpurple/purplenotificationlink.h	Fri Feb 07 00:14:03 2025 -0600
+++ b/libpurple/purplenotificationlink.h	Fri Feb 14 02:12:52 2025 -0600
@@ -58,7 +58,7 @@
  *
  * Creates a new [class@Notification] with a link to @link_uri.
  *
- * Returns: The new notification.
+ * Returns: (transfer full) (type PurpleNotificationLink): The new notification.
  *
  * Since: 3.0
  */
--- a/libpurple/purpleplugininfo.h	Fri Feb 07 00:14:03 2025 -0600
+++ b/libpurple/purpleplugininfo.h	Fri Feb 14 02:12:52 2025 -0600
@@ -204,7 +204,7 @@
  * See #PURPLE_PLUGIN_ABI_VERSION,
  *     <link linkend="chapter-plugin-ids">Plugin IDs</link>.
  *
- * Returns: A new #PurplePluginInfo instance.
+ * Returns: (transfer full) (type PurplePluginInfo): The new plugin info.
  *
  * Since: 3.0
  */
--- a/libpurple/purplesqlitehistoryadapter.h	Fri Feb 07 00:14:03 2025 -0600
+++ b/libpurple/purplesqlitehistoryadapter.h	Fri Feb 14 02:12:52 2025 -0600
@@ -57,7 +57,8 @@
  *
  * Creates a new #PurpleHistoryAdapter.
  *
- * Returns: (transfer full): The new #PurpleSqliteHistoryAdapter instance.
+ * Returns: (transfer full) (type PurpleSqliteHistoryAdapter): The new history
+ *          adapter.
  *
  * Since: 3.0
  */
--- a/libpurple/request/purplerequestfieldaccount.h	Fri Feb 07 00:14:03 2025 -0600
+++ b/libpurple/request/purplerequestfieldaccount.h	Fri Feb 14 02:12:52 2025 -0600
@@ -76,7 +76,7 @@
  *
  * By default, this field will not show offline accounts.
  *
- * Returns: (transfer full): The new field.
+ * Returns: (transfer full) (type PurpleRequestFieldAccount): The new field.
  */
 PURPLE_AVAILABLE_IN_ALL
 PurpleRequestField *purple_request_field_account_new(const char *id, const char *text, PurpleAccount *account);
--- a/libpurple/request/purplerequestfieldbool.h	Fri Feb 07 00:14:03 2025 -0600
+++ b/libpurple/request/purplerequestfieldbool.h	Fri Feb 14 02:12:52 2025 -0600
@@ -58,7 +58,7 @@
  *
  * This is often represented as a checkbox.
  *
- * Returns: (transfer full): The new field.
+ * Returns: (transfer full) (type PurpleRequestFieldBool): The new field.
  */
 PURPLE_AVAILABLE_IN_ALL
 PurpleRequestField *purple_request_field_bool_new(const char *id, const char *text, gboolean default_value);
--- a/libpurple/request/purplerequestfieldchoice.h	Fri Feb 07 00:14:03 2025 -0600
+++ b/libpurple/request/purplerequestfieldchoice.h	Fri Feb 14 02:12:52 2025 -0600
@@ -58,7 +58,7 @@
  *
  * This is often represented as a group of radio buttons.
  *
- * Returns: (transfer full): The new field.
+ * Returns: (transfer full) (type PurpleRequestFieldChoice): The new field.
  */
 PURPLE_AVAILABLE_IN_ALL
 PurpleRequestField *purple_request_field_choice_new(const char *id, const char *text, gpointer default_value);
--- a/libpurple/request/purplerequestfieldimage.h	Fri Feb 07 00:14:03 2025 -0600
+++ b/libpurple/request/purplerequestfieldimage.h	Fri Feb 14 02:12:52 2025 -0600
@@ -60,7 +60,7 @@
  *
  * Creates an image field.
  *
- * Returns: (transfer full): The new field.
+ * Returns: (transfer full) (type PurpleRequestFieldImage): The new field.
  */
 PURPLE_AVAILABLE_IN_ALL
 PurpleRequestField *purple_request_field_image_new(const char *id, const char *text, const char *buf, gsize size);
--- a/libpurple/request/purplerequestfieldint.h	Fri Feb 07 00:14:03 2025 -0600
+++ b/libpurple/request/purplerequestfieldint.h	Fri Feb 14 02:12:52 2025 -0600
@@ -58,7 +58,7 @@
  *
  * Creates an integer field.
  *
- * Returns: (transfer full): The new field.
+ * Returns: (transfer full) (type PurpleRequestFieldInt): The new field.
  */
 PURPLE_AVAILABLE_IN_ALL
 PurpleRequestField *purple_request_field_int_new(const char *id, const char *text, int default_value, int lower_bound, int upper_bound);
--- a/libpurple/request/purplerequestfieldlabel.h	Fri Feb 07 00:14:03 2025 -0600
+++ b/libpurple/request/purplerequestfieldlabel.h	Fri Feb 14 02:12:52 2025 -0600
@@ -55,7 +55,7 @@
  *
  * Creates a label field.
  *
- * Returns: (transfer full): The new field.
+ * Returns: (transfer full) (type PurpleRequestFieldLabel): The new field.
  */
 PURPLE_AVAILABLE_IN_ALL
 PurpleRequestField *purple_request_field_label_new(const char *id, const char *text);
--- a/libpurple/request/purplerequestfieldlist.h	Fri Feb 07 00:14:03 2025 -0600
+++ b/libpurple/request/purplerequestfieldlist.h	Fri Feb 14 02:12:52 2025 -0600
@@ -55,7 +55,7 @@
  *
  * Creates a multiple list item field.
  *
- * Returns: (transfer full): The new field.
+ * Returns: (transfer full) (type PurpleRequestFieldList): The new field.
  */
 PURPLE_AVAILABLE_IN_ALL
 PurpleRequestField *purple_request_field_list_new(const char *id, const char *text);
--- a/libpurple/request/purplerequestfieldstring.h	Fri Feb 07 00:14:03 2025 -0600
+++ b/libpurple/request/purplerequestfieldstring.h	Fri Feb 14 02:12:52 2025 -0600
@@ -57,7 +57,7 @@
  *
  * Creates a string request field.
  *
- * Returns: (transfer full): The new field.
+ * Returns: (transfer full) (type PurpleRequestFieldString): The new field.
  */
 PURPLE_AVAILABLE_IN_ALL
 PurpleRequestField *purple_request_field_string_new(const char *id, const char *text, const char *default_value, gboolean multiline);

mercurial