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_NOTIFICATION_CONNECTION_ERROR_H #define PURPLE_NOTIFICATION_CONNECTION_ERROR_H #include <glib.h> #include <glib-object.h> #include "purplenotification.h" #include "purpleversion.h" G_BEGIN_DECLS /** * PurpleNotificationConnectionError: * * A [class@Notification] for connection errors on [class@Account]. * * Since: 3.0 */ #define PURPLE_TYPE_NOTIFICATION_CONNECTION_ERROR (purple_notification_connection_error_get_type()) PURPLE_AVAILABLE_IN_3_0 G_DECLARE_FINAL_TYPE(PurpleNotificationConnectionError, purple_notification_connection_error, PURPLE, NOTIFICATION_CONNECTION_ERROR, PurpleNotification) #include "purpleaccount.h" /** * purple_notification_connection_error_new: * @id: (nullable): An identifier for this notification. * @account: The account. * * Creates a new [class@Notification] for a connection error on @account. * * Returns: (transfer full) (type PurpleNotificationConnectionError): The new * notification. * * Since: 3.0 */ PURPLE_AVAILABLE_IN_3_0 PurpleNotification *purple_notification_connection_error_new(const char *id, PurpleAccount *account); G_END_DECLS #endif /* PURPLE_NOTIFICATION_CONNECTION_ERROR_H */