Drop broken GIR namespace directive - #967
Conversation
GIR doesn't quite support multiple namespace nodes inside the same GIR file. I don't believe having a separate GraniteServices.gir was ever the intention here, nor is it really possible. Removing this, coupled with https://gitlab.gnome.org/GNOME/vala/-/merge_requests/449 on the Vala side, makes the GIR for libgranite actually useable. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
|
@davidmhewitt I know you were working on Granite and you're maintaining Rust bindings, could you please advice/review? |
|
How do we move this forward? |
|
@danirabbit maybe you'll be able to help? |
|
This line seemed to be added in #288. |
|
I compared the .gir file between the one generated from latest main (67750eb) and the one from this branch (edf4335) with the following steps: Result: Details--- /home/user/elementary-granite/builddir/lib/Granite-9.0.gir 2026-08-02 10:06:15.688023027 +0900
+++ /home/user/bugaevc-granite/builddir/lib/Granite-9.0.gir 2026-08-02 10:07:09.962443521 +0900
@@ -251,20 +251,20 @@
</glib:signal>
<function name="get_instance" c:identifier="granite_services_contractor_proxy_get_instance" throws="1">
<return-value transfer-ownership="full">
- <type name="Granite.GraniteServicesContractorProxy" c:type="GraniteServicesContractorProxy*"/>
+ <type name="Granite.ServicesContractorProxy" c:type="GraniteServicesContractorProxy*"/>
</return-value>
</function>
<function name="get_all_contracts" c:identifier="granite_services_contractor_proxy_get_all_contracts" throws="1">
<return-value transfer-ownership="full">
<type name="Gee.List" c:type="GeeList*">
- <type name="Granite.GraniteServicesContract" c:type="GraniteServicesContract*"/>
+ <type name="Granite.ServicesContract" c:type="GraniteServicesContract*"/>
</type>
</return-value>
</function>
<function name="get_contracts_by_mime" c:identifier="granite_services_contractor_proxy_get_contracts_by_mime" throws="1">
<return-value transfer-ownership="full">
<type name="Gee.List" c:type="GeeList*">
- <type name="Granite.GraniteServicesContract" c:type="GraniteServicesContract*"/>
+ <type name="Granite.ServicesContract" c:type="GraniteServicesContract*"/>
</type>
</return-value>
<parameters>
@@ -276,7 +276,7 @@
<function name="get_contracts_by_mimelist" c:identifier="granite_services_contractor_proxy_get_contracts_by_mimelist" throws="1">
<return-value transfer-ownership="full">
<type name="Gee.List" c:type="GeeList*">
- <type name="Granite.GraniteServicesContract" c:type="GraniteServicesContract*"/>
+ <type name="Granite.ServicesContract" c:type="GraniteServicesContract*"/>
</type>
</return-value>
<parameters>
@@ -293,7 +293,7 @@
<function name="get_contracts_for_file" c:identifier="granite_services_contractor_proxy_get_contracts_for_file" throws="1">
<return-value transfer-ownership="full">
<type name="Gee.List" c:type="GeeList*">
- <type name="Granite.GraniteServicesContract" c:type="GraniteServicesContract*"/>
+ <type name="Granite.ServicesContract" c:type="GraniteServicesContract*"/>
</type>
</return-value>
<parameters>
@@ -305,7 +305,7 @@
<function name="get_contracts_for_files" c:identifier="granite_services_contractor_proxy_get_contracts_for_files" throws="1">
<return-value transfer-ownership="full">
<type name="Gee.List" c:type="GeeList*">
- <type name="Granite.GraniteServicesContract" c:type="GraniteServicesContract*"/>
+ <type name="Granite.ServicesContract" c:type="GraniteServicesContract*"/>
</type>
</return-value>
<parameters>
@@ -340,7 +340,7 @@
</function>
<constructor name="new" c:identifier="granite_services_system_new">
<return-value transfer-ownership="full">
- <type name="Granite.GraniteServicesSystem" c:type="GraniteServicesSystem*"/>
+ <type name="Granite.ServicesSystem" c:type="GraniteServicesSystem*"/>
</return-value>
</constructor>
<field name="priv" readable="0" private="1">
@@ -361,7 +361,7 @@
</return-value>
<parameters>
<instance-parameter name="self" transfer-ownership="none">
- <type name="Granite.GraniteServicesContract" c:type="GraniteServicesContract*"/>
+ <type name="Granite.ServicesContract" c:type="GraniteServicesContract*"/>
</instance-parameter>
</parameters>
</method>
@@ -371,7 +371,7 @@
</return-value>
<parameters>
<instance-parameter name="self" transfer-ownership="none">
- <type name="Granite.GraniteServicesContract" c:type="GraniteServicesContract*"/>
+ <type name="Granite.ServicesContract" c:type="GraniteServicesContract*"/>
</instance-parameter>
</parameters>
</virtual-method>
@@ -381,7 +381,7 @@
</return-value>
<parameters>
<instance-parameter name="self" transfer-ownership="none">
- <type name="Granite.GraniteServicesContract" c:type="GraniteServicesContract*"/>
+ <type name="Granite.ServicesContract" c:type="GraniteServicesContract*"/>
</instance-parameter>
</parameters>
</method>
@@ -391,7 +391,7 @@
</return-value>
<parameters>
<instance-parameter name="self" transfer-ownership="none">
- <type name="Granite.GraniteServicesContract" c:type="GraniteServicesContract*"/>
+ <type name="Granite.ServicesContract" c:type="GraniteServicesContract*"/>
</instance-parameter>
</parameters>
</virtual-method>
@@ -401,7 +401,7 @@
</return-value>
<parameters>
<instance-parameter name="self" transfer-ownership="none">
- <type name="Granite.GraniteServicesContract" c:type="GraniteServicesContract*"/>
+ <type name="Granite.ServicesContract" c:type="GraniteServicesContract*"/>
</instance-parameter>
</parameters>
</method>
@@ -411,7 +411,7 @@
</return-value>
<parameters>
<instance-parameter name="self" transfer-ownership="none">
- <type name="Granite.GraniteServicesContract" c:type="GraniteServicesContract*"/>
+ <type name="Granite.ServicesContract" c:type="GraniteServicesContract*"/>
</instance-parameter>
</parameters>
</virtual-method>
@@ -421,7 +421,7 @@
</return-value>
<parameters>
<instance-parameter name="self" transfer-ownership="none">
- <type name="Granite.GraniteServicesContract" c:type="GraniteServicesContract*"/>
+ <type name="Granite.ServicesContract" c:type="GraniteServicesContract*"/>
</instance-parameter>
<parameter name="file" transfer-ownership="none">
<type name="Gio.File" c:type="GFile*"/>
@@ -434,7 +434,7 @@
</return-value>
<parameters>
<instance-parameter name="self" transfer-ownership="none">
- <type name="Granite.GraniteServicesContract" c:type="GraniteServicesContract*"/>
+ <type name="Granite.ServicesContract" c:type="GraniteServicesContract*"/>
</instance-parameter>
<parameter name="file" transfer-ownership="none">
<type name="Gio.File" c:type="GFile*"/>
@@ -447,7 +447,7 @@
</return-value>
<parameters>
<instance-parameter name="self" transfer-ownership="none">
- <type name="Granite.GraniteServicesContract" c:type="GraniteServicesContract*"/>
+ <type name="Granite.ServicesContract" c:type="GraniteServicesContract*"/>
</instance-parameter>
<parameter name="files" transfer-ownership="none">
<array length="1" c:type="GFile**">
@@ -465,7 +465,7 @@
</return-value>
<parameters>
<instance-parameter name="self" transfer-ownership="none">
- <type name="Granite.GraniteServicesContract" c:type="GraniteServicesContract*"/>
+ <type name="Granite.ServicesContract" c:type="GraniteServicesContract*"/>
</instance-parameter>
<parameter name="files" transfer-ownership="none">
<array length="1" c:type="GFile**">
@@ -489,7 +489,7 @@
</return-value>
<parameters>
<parameter name="self" transfer-ownership="none">
- <type name="Granite.GraniteServicesContract" c:type="GraniteServicesContract*"/>
+ <type name="Granite.ServicesContract" c:type="GraniteServicesContract*"/>
</parameter>
</parameters>
</callback>
@@ -501,7 +501,7 @@
</return-value>
<parameters>
<parameter name="self" transfer-ownership="none">
- <type name="Granite.GraniteServicesContract" c:type="GraniteServicesContract*"/>
+ <type name="Granite.ServicesContract" c:type="GraniteServicesContract*"/>
</parameter>
</parameters>
</callback>
@@ -513,7 +513,7 @@
</return-value>
<parameters>
<parameter name="self" transfer-ownership="none">
- <type name="Granite.GraniteServicesContract" c:type="GraniteServicesContract*"/>
+ <type name="Granite.ServicesContract" c:type="GraniteServicesContract*"/>
</parameter>
</parameters>
</callback>
@@ -525,7 +525,7 @@
</return-value>
<parameters>
<parameter name="self" transfer-ownership="none">
- <type name="Granite.GraniteServicesContract" c:type="GraniteServicesContract*"/>
+ <type name="Granite.ServicesContract" c:type="GraniteServicesContract*"/>
</parameter>
<parameter name="file" transfer-ownership="none">
<type name="Gio.File" c:type="GFile*"/>
@@ -540,7 +540,7 @@
</return-value>
<parameters>
<parameter name="self" transfer-ownership="none">
- <type name="Granite.GraniteServicesContract" c:type="GraniteServicesContract*"/>
+ <type name="Granite.ServicesContract" c:type="GraniteServicesContract*"/>
</parameter>
<parameter name="files" transfer-ownership="none">
<array length="2" c:type="GFile**">
@@ -562,7 +562,7 @@
</return-value>
<parameters>
<instance-parameter name="self" transfer-ownership="none">
- <type name="Granite.GraniteServicesSettingsSerializable" c:type="GraniteServicesSettingsSerializable*"/>
+ <type name="Granite.ServicesSettingsSerializable" c:type="GraniteServicesSettingsSerializable*"/>
</instance-parameter>
</parameters>
</method>
@@ -572,7 +572,7 @@
</return-value>
<parameters>
<instance-parameter name="self" transfer-ownership="none">
- <type name="Granite.GraniteServicesSettingsSerializable" c:type="GraniteServicesSettingsSerializable*"/>
+ <type name="Granite.ServicesSettingsSerializable" c:type="GraniteServicesSettingsSerializable*"/>
</instance-parameter>
</parameters>
</virtual-method>
@@ -582,7 +582,7 @@
</return-value>
<parameters>
<instance-parameter name="self" transfer-ownership="none">
- <type name="Granite.GraniteServicesSettingsSerializable" c:type="GraniteServicesSettingsSerializable*"/>
+ <type name="Granite.ServicesSettingsSerializable" c:type="GraniteServicesSettingsSerializable*"/>
</instance-parameter>
<parameter name="s" transfer-ownership="none">
<type name="utf8" c:type="const gchar*"/>
@@ -595,7 +595,7 @@
</return-value>
<parameters>
<instance-parameter name="self" transfer-ownership="none">
- <type name="Granite.GraniteServicesSettingsSerializable" c:type="GraniteServicesSettingsSerializable*"/>
+ <type name="Granite.ServicesSettingsSerializable" c:type="GraniteServicesSettingsSerializable*"/>
</instance-parameter>
<parameter name="s" transfer-ownership="none">
<type name="utf8" c:type="const gchar*"/>
@@ -614,7 +614,7 @@
</return-value>
<parameters>
<parameter name="self" transfer-ownership="none">
- <type name="Granite.GraniteServicesSettingsSerializable" c:type="GraniteServicesSettingsSerializable*"/>
+ <type name="Granite.ServicesSettingsSerializable" c:type="GraniteServicesSettingsSerializable*"/>
</parameter>
</parameters>
</callback>
@@ -626,7 +626,7 @@
</return-value>
<parameters>
<parameter name="self" transfer-ownership="none">
- <type name="Granite.GraniteServicesSettingsSerializable" c:type="GraniteServicesSettingsSerializable*"/>
+ <type name="Granite.ServicesSettingsSerializable" c:type="GraniteServicesSettingsSerializable*"/>
</parameter>
<parameter name="s" transfer-ownership="none">
<type name="utf8" c:type="const gchar*"/> |
|
To check the effect of changes in this PR, I created a test GTK 4 / Granite 9 application that uses https://github.com/ryonakano/junk/blob/elementary-granite-967-test/src/MainWindow.vala Of course first I built and installed this branch of Granite 9. It builds, runs, and works as expected; it shows the "Compress" label in the button and presents the File Roller window when clicking it:
which is the same behavior that you can see from the context menu of a PDF file in Files:
|
|
@bugaevc Hi, sorry for our late review. I wrote my understanding below so would you check if it's true? The intended output of [CCode (gir_namespace = "GraniteServices", gir_version = "1.0")]would be like this ideally <type name="GraniteServices.ContractorProxy" c:type="GraniteServicesContractorProxy*"/>but that isn't possbile at the moment (requires larger changes in Vala) and the results is this at the moment <type name="Granite.GraniteServicesContractorProxy" c:type="GraniteServicesContractorProxy*"/>and this causes some problems once https://gitlab.gnome.org/GNOME/vala/-/merge_requests/449 is merged. So you removed the gir annotation which does not work as expected anyways. |
|
Also, does the following code also needs to be updated similar to here? |
|
Hi, thanks for taking a look!
This change here is not supposed to have any effect on either Vala or C APIs, it only affects GIR, meaning what Granite looks like from e.g. Python.
Yes, but moreover, the definition of
Yes. But it's not just Vala: I seriously doubt that GIR is even meant to support having multiple namespaces defined in a single What GTK and other projects that want to export multiple GIR namespaces do is they create multiple GIR files (e.g.
Well, for one thing having Another point here is that I don't see a reason to believe that @tintou ever intended that to be a separate GIR |


Background: I'm hacking on Vala GIR generation (see https://gitlab.gnome.org/GNOME/vala/-/merge_requests/449). This line here is breaking things.
GIR doesn't quite support multiple
namespacenodes inside the same GIR file. I don't believe having a separateGraniteServices.girwas ever the intention here, nor is it really possible.The version bump to 9 is the high time to fix it.