Fri, 14 Feb 2025 02:12:52 -0600
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/
/* * Purple - Internet Messaging Library * Copyright (C) Pidgin Developers <devel@pidgin.im> * * Purple is the legal property of its developers, whose names are too numerous * to list here. Please refer to the COPYRIGHT file distributed with this * source distribution. * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation; either version 2 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this library; if not, see <https://www.gnu.org/licenses/>. */ #if !defined(PURPLE_GLOBAL_HEADER_INSIDE) && !defined(PURPLE_COMPILATION) # error "only <purple.h> may be included directly" #endif #ifndef PURPLE_REQUEST_FIELD_IMAGE_H #define PURPLE_REQUEST_FIELD_IMAGE_H #include <glib.h> #include <glib-object.h> #include "purpleversion.h" /** * PurpleRequestFieldImage: * * An image request field. * * Since: 3.0 */ typedef struct _PurpleRequestFieldImage PurpleRequestFieldImage; #include "purplerequestfield.h" G_BEGIN_DECLS #define PURPLE_TYPE_REQUEST_FIELD_IMAGE (purple_request_field_image_get_type()) PURPLE_AVAILABLE_IN_3_0 G_DECLARE_FINAL_TYPE(PurpleRequestFieldImage, purple_request_field_image, PURPLE, REQUEST_FIELD_IMAGE, PurpleRequestField) /** * purple_request_field_image_new: * @id: The field ID. * @text: The label of the field. * @buf: The image data. * @size: The size of the data in @buf. * * Creates an image 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); /** * purple_request_field_image_set_scale: * @field: The image field. * @x: The x scale factor. * @y: The y scale factor. * * Sets the scale factors of an image field. */ PURPLE_AVAILABLE_IN_ALL void purple_request_field_image_set_scale(PurpleRequestFieldImage *field, unsigned int x, unsigned int y); /** * purple_request_field_image_get_buffer: * @field: The image field. * * Returns pointer to the image. * * Returns: Pointer to the image. */ PURPLE_AVAILABLE_IN_ALL const char *purple_request_field_image_get_buffer(PurpleRequestFieldImage *field); /** * purple_request_field_image_get_size: * @field: The image field. * * Returns size (in bytes) of the image. * * Returns: Size of the image. */ PURPLE_AVAILABLE_IN_ALL gsize purple_request_field_image_get_size(PurpleRequestFieldImage *field); /** * purple_request_field_image_get_scale_x: * @field: The image field. * * Returns X scale coefficient of the image. * * Returns: X scale coefficient of the image. */ PURPLE_AVAILABLE_IN_ALL unsigned int purple_request_field_image_get_scale_x(PurpleRequestFieldImage *field); /** * purple_request_field_image_get_scale_y: * @field: The image field. * * Returns Y scale coefficient of the image. * * Returns: Y scale coefficient of the image. */ PURPLE_AVAILABLE_IN_ALL unsigned int purple_request_field_image_get_scale_y(PurpleRequestFieldImage *field); G_END_DECLS #endif /* PURPLE_REQUEST_FIELD_IMAGE_H */