parser: Fix handling of initialization functions for interfaces

With the new G_DEFINE_INTERFACE macro, the interface initialization
function is named *_default_init, so we need to handle that like
*_base_init and *_class_init.

Reparse gtk/gtk-api.raw and gio/gio-api.raw. This creates some new
signals that were previously incorrectly reported as virtual methods,
and also adds some properties.
This commit is contained in:
Bertrand Lorentz 2011-07-05 22:59:27 +02:00
parent 59e38f55dc
commit ad74c64345
4 changed files with 123 additions and 94 deletions

View file

@ -674,6 +674,11 @@
<method vm="set_state" />
<method vm="activate" />
</class_struct>
<property name="Name" cname="name" type="gchar*" readable="true" writeable="true" construct-only="true" />
<property name="ParameterType" cname="parameter-type" type="GVariantType" readable="true" writeable="true" construct-only="true" />
<property name="Enabled" cname="enabled" type="gboolean" readable="true" writeable="true" construct="true" />
<property name="StateType" cname="state-type" type="GVariantType" readable="true" />
<property name="State" cname="state" type="variant" readable="true" writeable="true" construct="true" />
<virtual_method name="GetName" cname="get_name">
<return-type type="gchar*" />
<parameters />
@ -756,11 +761,37 @@
<method vm="get_action_state" />
<method vm="change_action_state" />
<method vm="activate_action" />
<method vm="action_added" />
<method vm="action_removed" />
<method vm="action_enabled_changed" />
<method vm="action_state_changed" />
<method signal_vm="action_added" />
<method signal_vm="action_removed" />
<method signal_vm="action_enabled_changed" />
<method signal_vm="action_state_changed" />
</class_struct>
<signal name="ActionAdded" cname="action-added" when="LAST" field_name="action_added">
<return-type type="void" />
<parameters>
<parameter type="const-gchar*" name="action_name" />
</parameters>
</signal>
<signal name="ActionRemoved" cname="action-removed" when="LAST" field_name="action_removed">
<return-type type="void" />
<parameters>
<parameter type="const-gchar*" name="action_name" />
</parameters>
</signal>
<signal name="ActionEnabledChanged" cname="action-enabled-changed" when="LAST" field_name="action_enabled_changed">
<return-type type="void" />
<parameters>
<parameter type="const-gchar*" name="action_name" />
<parameter type="gboolean" name="enabled" />
</parameters>
</signal>
<signal name="ActionStateChanged" cname="action-state-changed" when="LAST" field_name="action_state_changed">
<return-type type="void" />
<parameters>
<parameter type="const-gchar*" name="action_name" />
<parameter type="GVariant*" name="value" />
</parameters>
</signal>
<virtual_method name="HasAction" cname="has_action">
<return-type type="gboolean" />
<parameters>
@ -815,32 +846,6 @@
<parameter type="GVariant*" name="parameter" />
</parameters>
</virtual_method>
<virtual_method name="ActionAdded" cname="action_added">
<return-type type="void" />
<parameters>
<parameter type="const-gchar*" name="action_name" />
</parameters>
</virtual_method>
<virtual_method name="ActionRemoved" cname="action_removed">
<return-type type="void" />
<parameters>
<parameter type="const-gchar*" name="action_name" />
</parameters>
</virtual_method>
<virtual_method name="ActionEnabledChanged" cname="action_enabled_changed">
<return-type type="void" />
<parameters>
<parameter type="const-gchar*" name="action_name" />
<parameter type="gboolean" name="enabled" />
</parameters>
</virtual_method>
<virtual_method name="ActionStateChanged" cname="action_state_changed">
<return-type type="void" />
<parameters>
<parameter type="const-gchar*" name="action_name" />
<parameter type="GVariant*" name="value" />
</parameters>
</virtual_method>
<method name="ActionAdded" cname="g_action_group_action_added">
<return-type type="void" />
<parameters>
@ -1396,9 +1401,9 @@
<interface name="Drive" cname="GDrive">
<class_struct cname="GDriveIface">
<field name="GIface" cname="g_iface" type="GTypeInterface" />
<method vm="changed" />
<method vm="disconnected" />
<method vm="eject_button" />
<method signal_vm="changed" />
<method signal_vm="disconnected" />
<method signal_vm="eject_button" />
<method vm="get_name" />
<method vm="get_icon" />
<method vm="has_volumes" />
@ -1422,22 +1427,26 @@
<method vm="can_stop" />
<method vm="stop" />
<method vm="stop_finish" />
<method vm="stop_button" />
<method signal_vm="stop_button" />
<method vm="eject_with_operation" />
<method vm="eject_with_operation_finish" />
</class_struct>
<virtual_method name="Changed" cname="changed">
<signal name="Changed" cname="changed" when="LAST" field_name="changed">
<return-type type="void" />
<parameters />
</virtual_method>
<virtual_method name="Disconnected" cname="disconnected">
</signal>
<signal name="Disconnected" cname="disconnected" when="LAST" field_name="disconnected">
<return-type type="void" />
<parameters />
</virtual_method>
<virtual_method name="EjectButton" cname="eject_button">
</signal>
<signal name="EjectButton" cname="eject-button" when="LAST" field_name="eject_button">
<return-type type="void" />
<parameters />
</virtual_method>
</signal>
<signal name="StopButton" cname="stop-button" when="LAST" field_name="stop_button">
<return-type type="void" />
<parameters />
</signal>
<virtual_method name="GetName" cname="get_name">
<return-type type="char*" />
<parameters />
@ -1565,10 +1574,6 @@
<parameter type="GError**" name="error" />
</parameters>
</virtual_method>
<virtual_method name="StopButton" cname="stop_button">
<return-type type="void" />
<parameters />
</virtual_method>
<virtual_method name="EjectWithOperation" cname="eject_with_operation">
<return-type type="void" />
<parameters>
@ -3596,8 +3601,8 @@
<interface name="Mount" cname="GMount">
<class_struct cname="GMountIface">
<field name="GIface" cname="g_iface" type="GTypeInterface" />
<method vm="changed" />
<method vm="unmounted" />
<method signal_vm="changed" />
<method signal_vm="unmounted" />
<method vm="get_root" />
<method vm="get_name" />
<method vm="get_icon" />
@ -3615,21 +3620,25 @@
<method vm="guess_content_type" />
<method vm="guess_content_type_finish" />
<method vm="guess_content_type_sync" />
<method vm="pre_unmount" />
<method signal_vm="pre_unmount" />
<method vm="unmount_with_operation" />
<method vm="unmount_with_operation_finish" />
<method vm="eject_with_operation" />
<method vm="eject_with_operation_finish" />
<method vm="get_default_location" />
</class_struct>
<virtual_method name="Changed" cname="changed">
<signal name="Changed" cname="changed" when="LAST" field_name="changed">
<return-type type="void" />
<parameters />
</virtual_method>
<virtual_method name="Unmounted" cname="unmounted">
</signal>
<signal name="Unmounted" cname="unmounted" when="LAST" field_name="unmounted">
<return-type type="void" />
<parameters />
</virtual_method>
</signal>
<signal name="PreUnmount" cname="pre-unmount" when="LAST" field_name="pre_unmount">
<return-type type="void" />
<parameters />
</signal>
<virtual_method name="GetRoot" cname="get_root">
<return-type type="GFile*" />
<parameters />
@ -3735,10 +3744,6 @@
<parameter type="GError**" name="error" />
</parameters>
</virtual_method>
<virtual_method name="PreUnmount" cname="pre_unmount">
<return-type type="void" />
<parameters />
</virtual_method>
<virtual_method name="UnmountWithOperation" cname="unmount_with_operation">
<return-type type="void" />
<parameters>
@ -4317,6 +4322,10 @@
<class_struct cname="GTlsClientConnectionInterface">
<field name="GIface" cname="g_iface" type="GTypeInterface" />
</class_struct>
<property name="ValidationFlags" cname="validation-flags" type="GTlsCertificateFlags" readable="true" writeable="true" construct="true" />
<property name="ServerIdentity" cname="server-identity" type="GSocketConnectable" readable="true" writeable="true" construct="true" />
<property name="UseSsl3" cname="use-ssl3" type="gboolean" readable="true" writeable="true" construct="true" />
<property name="AcceptedCas" cname="accepted-cas" type="gpointer" readable="true" />
<method name="GetAcceptedCas" cname="g_tls_client_connection_get_accepted_cas">
<return-type type="GList*" />
</method>
@ -4362,6 +4371,7 @@
<class_struct cname="GTlsServerConnectionInterface">
<field name="GIface" cname="g_iface" type="GTypeInterface" />
</class_struct>
<property name="AuthenticationMode" cname="authentication-mode" type="GTlsAuthenticationMode" readable="true" writeable="true" />
<method name="GetType" cname="g_tls_server_connection_get_type" shared="true">
<return-type type="GType" />
</method>
@ -4376,8 +4386,8 @@
<interface name="Volume" cname="GVolume">
<class_struct cname="GVolumeIface">
<field name="GIface" cname="g_iface" type="GTypeInterface" />
<method vm="changed" />
<method vm="removed" />
<method signal_vm="changed" />
<method signal_vm="removed" />
<method vm="get_name" />
<method vm="get_icon" />
<method vm="get_uuid" />
@ -4396,14 +4406,14 @@
<method vm="eject_with_operation" />
<method vm="eject_with_operation_finish" />
</class_struct>
<virtual_method name="Changed" cname="changed">
<signal name="Changed" cname="changed" when="LAST" field_name="changed">
<return-type type="void" />
<parameters />
</virtual_method>
<virtual_method name="Removed" cname="removed">
</signal>
<signal name="Removed" cname="removed" when="LAST" field_name="removed">
<return-type type="void" />
<parameters />
</virtual_method>
</signal>
<virtual_method name="GetName" cname="get_name">
<return-type type="char*" />
<parameters />

View file

@ -1259,6 +1259,8 @@
<method vm="update" />
<method vm="sync_action_properties" />
</class_struct>
<property name="RelatedAction" cname="related-action" type="GtkAction" readable="true" writeable="true" />
<property name="UseActionAppearance" cname="use-action-appearance" type="gboolean" readable="true" writeable="true" />
<virtual_method name="Update" cname="update">
<return-type type="void" />
<parameters>
@ -1488,18 +1490,19 @@
<interface name="CellEditable" cname="GtkCellEditable">
<class_struct cname="GtkCellEditableIface">
<field name="GIface" cname="g_iface" type="GTypeInterface" />
<method vm="editing_done" />
<method vm="remove_widget" />
<method signal_vm="editing_done" />
<method signal_vm="remove_widget" />
<method vm="start_editing" />
</class_struct>
<virtual_method name="EditingDone" cname="editing_done">
<property name="EditingCanceled" cname="editing-canceled" type="gboolean" readable="true" writeable="true" />
<signal name="EditingDone" cname="editing-done" when="LAST" field_name="editing_done">
<return-type type="void" />
<parameters />
</virtual_method>
<virtual_method name="RemoveWidget" cname="remove_widget">
</signal>
<signal name="RemoveWidget" cname="remove-widget" when="LAST" field_name="remove_widget">
<return-type type="void" />
<parameters />
</virtual_method>
</signal>
<virtual_method name="StartEditing" cname="start_editing">
<return-type type="void" />
<parameters>
@ -1823,12 +1826,43 @@
<method vm="add_shortcut_folder" />
<method vm="remove_shortcut_folder" />
<method vm="list_shortcut_folders" />
<method vm="current_folder_changed" />
<method vm="selection_changed" />
<method vm="update_preview" />
<method vm="file_activated" />
<method vm="confirm_overwrite" />
<method signal_vm="current_folder_changed" />
<method signal_vm="selection_changed" />
<method signal_vm="update_preview" />
<method signal_vm="file_activated" />
<method signal_vm="confirm_overwrite" />
</class_struct>
<signal name="CurrentFolderChanged" cname="current-folder-changed" when="LAST" field_name="current_folder_changed">
<return-type type="void" />
<parameters />
</signal>
<signal name="SelectionChanged" cname="selection-changed" when="LAST" field_name="selection_changed">
<return-type type="void" />
<parameters />
</signal>
<signal name="UpdatePreview" cname="update-preview" when="LAST" field_name="update_preview">
<return-type type="void" />
<parameters />
</signal>
<signal name="FileActivated" cname="file-activated" when="LAST" field_name="file_activated">
<return-type type="void" />
<parameters />
</signal>
<signal name="ConfirmOverwrite" cname="confirm-overwrite" when="LAST" field_name="confirm_overwrite">
<return-type type="GtkFileChooserConfirmation" />
<parameters />
</signal>
<property name="Action" cname="action" type="GtkFileChooserAction" readable="true" writeable="true" />
<property name="Filter" cname="filter" type="GtkFileFilter" readable="true" writeable="true" />
<property name="LocalOnly" cname="local-only" type="gboolean" readable="true" writeable="true" />
<property name="PreviewWidget" cname="preview-widget" type="GtkWidget" readable="true" writeable="true" />
<property name="PreviewWidgetActive" cname="preview-widget-active" type="gboolean" readable="true" writeable="true" />
<property name="UsePreviewLabel" cname="use-preview-label" type="gboolean" readable="true" writeable="true" />
<property name="ExtraWidget" cname="extra-widget" type="GtkWidget" readable="true" writeable="true" />
<property name="SelectMultiple" cname="select-multiple" type="gboolean" readable="true" writeable="true" />
<property name="ShowHidden" cname="show-hidden" type="gboolean" readable="true" writeable="true" />
<property name="DoOverwriteConfirmation" cname="do-overwrite-confirmation" type="gboolean" readable="true" writeable="true" />
<property name="CreateFolders" cname="create-folders" type="gboolean" readable="true" writeable="true" />
<virtual_method name="SetCurrentFolder" cname="set_current_folder">
<return-type type="gboolean" />
<parameters>
@ -1913,26 +1947,6 @@
<return-type type="GSList*" />
<parameters />
</virtual_method>
<virtual_method name="CurrentFolderChanged" cname="current_folder_changed">
<return-type type="void" />
<parameters />
</virtual_method>
<virtual_method name="SelectionChanged" cname="selection_changed">
<return-type type="void" />
<parameters />
</virtual_method>
<virtual_method name="UpdatePreview" cname="update_preview">
<return-type type="void" />
<parameters />
</virtual_method>
<virtual_method name="FileActivated" cname="file_activated">
<return-type type="void" />
<parameters />
</virtual_method>
<virtual_method name="ConfirmOverwrite" cname="confirm_overwrite">
<return-type type="GtkFileChooserConfirmation" />
<parameters />
</virtual_method>
<method name="AddFilter" cname="gtk_file_chooser_add_filter">
<return-type type="void" />
<parameters>
@ -2215,6 +2229,7 @@
<class_struct cname="GtkOrientableIface">
<field name="BaseIface" cname="base_iface" type="GTypeInterface" />
</class_struct>
<property name="Orientation" cname="orientation" type="GtkOrientation" readable="true" writeable="true" />
<method name="GetOrientation" cname="gtk_orientable_get_orientation">
<return-type type="GtkOrientation" />
</method>
@ -2563,6 +2578,10 @@
<class_struct cname="GtkScrollableInterface">
<field name="BaseIface" cname="base_iface" type="GTypeInterface" />
</class_struct>
<property name="" cname="" type="ginterface" />
<property name="" cname="" type="ginterface" />
<property name="" cname="" type="ginterface" />
<property name="" cname="" type="ginterface" />
<method name="GetHadjustment" cname="gtk_scrollable_get_hadjustment">
<return-type type="GtkAdjustment*" />
</method>

View file

@ -131,7 +131,7 @@ while ($line = <STDIN>) {
$sdef =~ s!/\*[^<].*?(\*/|\n)!!g;
$sdef =~ s/\n\s*//g;
$sdefs{$sname} = $sdef if (!exists ($sdefs{$sname}));
} elsif ($line =~ /^(\w+)_(class|base)_init\b/) {
} elsif ($line =~ /^(\w+)_(class|base|default)_init\b/) {
$class = StudlyCaps($1);
$pedef = $line;
while ($line = <STDIN>) {

View file

@ -207,7 +207,7 @@ foreach $fname (@srcs, @privhdrs) {
}
while ($line = <INFILE>) {
next if ($line !~ /^(struct|typedef struct.*;|\w+_class_init|\w+_base_init|\w+_get_type\b|G_DEFINE_TYPE_WITH_CODE|G_DEFINE_BOXED_TYPE|G_DEFINE_INTERFACE)/);
next if ($line !~ /^(struct|typedef struct.*;|\w+_class_init|\w+_base_init|\w+_default_init|\w+_get_type\b|G_DEFINE_TYPE_WITH_CODE|G_DEFINE_BOXED_TYPE|G_DEFINE_INTERFACE)/);
if ($line =~ /^G_DEFINE_(TYPE_WITH_CODE|BOXED_TYPE|INTERFACE)/) {
my $macro;