Merge pull request #22 from dufoli/master

Support properties in GInterface
This commit is contained in:
Mike Kestner 2011-08-03 12:19:19 -07:00
commit 6580e217f9
4 changed files with 96 additions and 18 deletions

View File

@ -6789,7 +6789,7 @@
<field name="ParentClass" cname="parent_class" type="GObjectClass" />
</class_struct>
<field name="Priv" cname="priv" type="GEmblemedIconPrivate*" />
<property name="" cname="" type="class" />
<property name="Gicon" cname="gicon" type="GIcon" readable="true" writeable="true" construct-only="true" />
<implements>
<interface cname="GIcon" />
</implements>

View File

@ -427,6 +427,10 @@
<attr path="/api/namespace/object[@cname='GtkLabel']/constructor[@cname='gtk_label_new_with_mnemonic']" name="preferred">1</attr>
<attr path="/api/namespace/object[@cname='GtkLabel']/constructor[@cname='gtk_label_new_with_mnemonic']/*/*[@name='str']" name="property_name">label</attr>
<attr path="/api/namespace/object[@cname='GtkLabel']/property[@name='WrapMode']" name="name">LineWrapMode</attr>
<attr path="/api/namespace/object[@cname='GtkLayout']/method[@name='GetHadjustment']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkLayout']/method[@name='GetVadjustment']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkLayout']/method[@name='SetHadjustment']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkLayout']/method[@name='SetVadjustment']" name="hidden">1</attr>
<add-node path="/api/namespace/object[@name='ListStore']"><implements><interface name="IEnumerable" /></implements></add-node>
<attr path="/api/namespace/object[@cname='GtkListStore']/constructor[@cname='gtk_list_store_new']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkListStore']/constructor[@cname='gtk_list_store_newv']" name="hidden">1</attr>
@ -696,15 +700,19 @@
<attr path="/api/namespace/object[@cname='GtkTextView']/method[@name='ForwardDisplayLine']/*/*[@type='GtkTextIter*']" name="pass_as">ref</attr>
<attr path="/api/namespace/object[@cname='GtkTextView']/method[@name='ForwardDisplayLineEnd']/*/*[@type='GtkTextIter*']" name="pass_as">ref</attr>
<attr path="/api/namespace/object[@cname='GtkTextView']/method[@name='GetDefaultAttributes']/return-type" name="owned">true</attr>
<attr path="/api/namespace/object[@cname='GtkTextView']/method[@name='GetHadjustment']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkTextView']/method[@name='GetIterAtLocation']/*/*[@type='GtkTextIter*']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTextView']/method[@name='GetLineAtY']/*/*[@type='GtkTextIter*']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTextView']/method[@name='GetIterLocation']/*/*[@type='GdkRectangle*']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTextView']/method[@name='GetVadjustment']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkTextView']/method[@name='GetVisibleRect']/*/*[@type='GdkRectangle*']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTextView']/method[@name='MoveVisually']/*/*[@type='GtkTextIter*']" name="pass_as">ref</attr>
<attr path="/api/namespace/object[@cname='GtkToggleAction']/method[@name='Toggled']" name="name">Toggle</attr>
<attr path="/api/namespace/object[@cname='GtkToggleButton']/constructor[@cname='gtk_toggle_button_new_with_mnemonic']" name="preferred">1</attr>
<attr path="/api/namespace/object[@cname='GtkToggleButton']/method[@name='Toggled']" name="name">Toggle</attr>
<attr path="/api/namespace/object[@cname='GtkToolItem']/method[@name='ToolbarReconfigured']" name="name">EmitToolbarReconfigured</attr>
<attr path="/api/namespace/object[@cname='GtkToolPalette']/method[@name='GetHadjustment']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkToolPalette']/method[@name='GetVadjustment']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkTreeModelFilter']/constructor[@cname='gtk_tree_model_filter_new']/*/*[@name='root']" name="property_name">virtual-root</attr>
<attr path="/api/namespace/object[@cname='GtkTreeModelFilter']/method[@name='ConvertIterToChildIter']/*/*[@name='child_iter']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTreeModelFilter']/method[@name='ConvertChildIterToIter']" name="hidden">1</attr>
@ -758,11 +766,13 @@
<attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='GetDragDestRow']/*/*[@name='path']" name="owned">true</attr>
<attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='GetDragDestRow']/*/*[@name='pos']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='GetGridLines']" name="name">GetEnableGridLines</attr>
<attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='GetHadjustment']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='GetBackgroundArea']/*/*[@name='rect']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='GetPathAtPos']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='GetTooltipContext']/*/parameter[@name='iter']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='GetTooltipContext']/*/parameter[@name='model']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='GetTooltipContext']/*/parameter[@name='path']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='GetVadjustment']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='GetVisibleRect']/*/*[@name='visible_rect']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='GetVisibleRange']/*/parameter" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='GetVisibleRange']/*/parameter" name="owned">true</attr>
@ -772,10 +782,16 @@
<attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='RowActivated']" name="name">ActivateRow</attr>
<attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='RowExpanded']" name="name">GetRowExpanded</attr>
<attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='SetGridLines']" name="name">SetEnableGridLines</attr>
<attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='SetHadjustment']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='SetVadjustment']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkUIManager']/constructor[@cname='gtk_ui_manager_new_merge_id']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkUIManager']/method[@name='AddUiFromFile']" name="win32_utf8_variant">true</attr>
<attr path="/api/namespace/object[@cname='GtkUIManager']/method[@cname='gtk_ui_manager_get_action_groups']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkUIManager']/method[@name='GetToplevels']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkViewport']/method[@name='GetHadjustment']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkViewport']/method[@name='GetVadjustment']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkViewport']/method[@name='SetHadjustment']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkViewport']/method[@name='SetVadjustment']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkVScale']/constructor[@cname='gtk_vscale_new_with_range']" name="hidden">1</attr>
<add-node path="/api/namespace/object[@cname='GtkWidget']"><custom-attribute>[GLib.TypeInitializer (typeof (Gtk.Widget), "ClassInit")]</custom-attribute></add-node>
<attr path="/api/namespace/object[@cname='GtkWidget']/constructor[@cname='gtk_widget_new']" name="hidden">1</attr>

View File

@ -2578,10 +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" />
<property name="Hadjustment" cname="hadjustment" type="GtkAdjustment" readable="true" writeable="true" construct="true" />
<property name="Vadjustment" cname="vadjustment" type="GtkAdjustment" readable="true" writeable="true" construct="true" />
<property name="HscrollPolicy" cname="hscroll-policy" type="GtkScrollablePolicy" readable="true" writeable="true" />
<property name="VscrollPolicy" cname="vscroll-policy" type="GtkScrollablePolicy" readable="true" writeable="true" />
<method name="GetHadjustment" cname="gtk_scrollable_get_hadjustment">
<return-type type="GtkAdjustment*" />
</method>
@ -4443,8 +4443,8 @@
<field name="Padding" cname="padding" type="gpointer" array_len="16" />
</class_struct>
<field name="Priv" cname="priv" type="GtkAppChooserButtonPrivate*" />
<property name="" cname="" type="class" />
<property name="" cname="" type="class" />
<property name="ShowDialogItem" cname="show-dialog-item" type="gboolean" readable="true" writeable="true" construct="true" />
<property name="Heading" cname="heading" type="gchar*" readable="true" writeable="true" />
<signal name="CustomItemActivated" cname="custom-item-activated" when="FIRST" field_name="custom_item_activated">
<return-type type="void" />
<parameters>
@ -4504,8 +4504,8 @@
<field name="Padding" cname="padding" type="gpointer" array_len="16" />
</class_struct>
<field name="Priv" cname="priv" type="GtkAppChooserDialogPrivate*" />
<property name="" cname="" type="class" />
<property name="" cname="" type="class" />
<property name="Gfile" cname="gfile" type="GFile" readable="true" writeable="true" construct-only="true" />
<property name="Heading" cname="heading" type="gchar*" readable="true" writeable="true" />
<implements>
<interface cname="GtkAppChooser" />
</implements>
@ -4558,12 +4558,12 @@
<field name="Padding" cname="padding" type="gpointer" array_len="16" />
</class_struct>
<field name="Priv" cname="priv" type="GtkAppChooserWidgetPrivate*" />
<property name="" cname="" type="class" />
<property name="" cname="" type="class" />
<property name="" cname="" type="class" />
<property name="" cname="" type="class" />
<property name="" cname="" type="class" />
<property name="" cname="" type="class" />
<property name="ShowDefault" cname="show-default" type="gboolean" readable="true" writeable="true" construct="true" />
<property name="ShowRecommended" cname="show-recommended" type="gboolean" readable="true" writeable="true" construct="true" />
<property name="ShowFallback" cname="show-fallback" type="gboolean" readable="true" writeable="true" construct="true" />
<property name="ShowOther" cname="show-other" type="gboolean" readable="true" writeable="true" construct="true" />
<property name="ShowAll" cname="show-all" type="gboolean" readable="true" writeable="true" construct="true" />
<property name="DefaultText" cname="default-text" type="gchar*" readable="true" writeable="true" />
<signal name="ApplicationSelected" cname="application-selected" when="FIRST" field_name="application_selected">
<return-type type="void" />
<parameters>
@ -13627,7 +13627,7 @@
<field name="Padding" cname="padding" type="gpointer" array_len="16" />
</class_struct>
<field name="Priv" cname="priv" type="GtkNumerableIconPrivate*" />
<property name="" cname="" type="class" />
<property name="BackgroundIconName" cname="background-icon-name" type="gchar*" readable="true" writeable="true" />
<method name="GetBackgroundGicon" cname="gtk_numerable_icon_get_background_gicon">
<return-type type="GIcon*" />
</method>
@ -18427,7 +18427,7 @@
<method vm="_switch_padding_7" />
</class_struct>
<field name="Priv" cname="priv" type="GtkSwitchPrivate*" />
<property name="" cname="" type="class" />
<property name="Active" cname="active" type="gboolean" readable="true" writeable="true" />
<virtual_method name="SwitchPadding1" cname="_switch_padding_1" shared="true" padding="true">
<return-type type="void" />
</virtual_method>

View File

@ -1015,6 +1015,53 @@ sub addPropElem
$prop_elem->setAttribute('construct-only', "true") if ($mode =~ /CONSTRUCT_ONLY/);
}
sub addPropElem2
{
my ($spec, $node, $is_child) = @_;
my ($name, $mode, $docs);
$spec =~ /g_param_spec_(\w+)\s*\((.*)\s*\);/;
my $type = $1;
my @params = split(/,/, $2);
$name = $params[0];
if ($defines{$name}) {
$name = $defines{$name};
} else {
$name =~ s/\s*\"//g;
}
$mode = $params[$#params];
if ($type =~ /boolean|float|double|^u?int|pointer|unichar/) {
$type = "g$type";
} elsif ($type =~ /string/) {
$type = "gchar*";
} elsif ($type =~ /boxed|object/) {
$type = $params[$#params-1];
$type =~ s/TYPE_//;
$type =~ s/\s+//g;
$type = StudlyCaps(lc($type));
} elsif ($type =~ /enum|flags/) {
$type = $params[$#params-2];
$type =~ s/TYPE_//;
$type =~ s/\s+//g;
$type = StudlyCaps(lc($type));
}
$prop_elem = $doc->createElement($is_child ? "childprop" : "property");
$node->appendChild($prop_elem);
$prop_elem->setAttribute('name', StudlyCaps($name));
$prop_elem->setAttribute('cname', $name);
$prop_elem->setAttribute('type', $type);
$prop_elem->setAttribute('readable', "true") if ($mode =~ /READ/);
$prop_elem->setAttribute('writeable', "true") if ($mode =~ /WRIT/);
$prop_elem->setAttribute('construct', "true") if ($mode =~ /CONSTRUCT(?!_)/);
$prop_elem->setAttribute('construct-only', "true") if ($mode =~ /CONSTRUCT_ONLY/);
}
sub parseTypeToken
{
my ($tok) = @_;
@ -1115,6 +1162,8 @@ sub parseInitFunc
my @signal_vms = ();
my $linenum = 0;
my $pspec = "";
my $pspec_use = 0;
while ($linenum < @init_lines) {
my $line = $init_lines[$linenum];
@ -1123,10 +1172,18 @@ sub parseInitFunc
# FIXME: This ignores the bool helper macro thingie.
} elsif ($line =~ /g_object_(class|interface)_install_prop/) {
my $prop = $line;
$pspec_use = 1;
while ($prop !~ /\)\s*;/) {
$prop .= $init_lines[++$linenum];
if ($init_lines[$linenum] =~ /g_param_spec_/) {
$pspec_use = 0;
}
}
if ($pspec_use) {
addPropElem2 ($prop.$pspec, $obj_el, 0);
} else {
addPropElem ($prop, $obj_el, 0);
}
addPropElem ($prop, $obj_el, 0);
$propcnt++;
} elsif ($line =~ /gtk_container_class_install_child_property/) {
my $prop = $line;
@ -1143,6 +1200,11 @@ sub parseInitFunc
$signal_vm = addSignalElem ($sig, $classdef, $obj_el);
push (@signal_vms, $signal_vm) if $signal_vm;
$sigcnt++;
} elsif ($line =~ /g_param_spec_/) {
$pspec = $line;
do {
$pspec .= $init_lines[++$linenum];
} until ($init_lines[$linenum] =~ /\)\s*;/);
}
$linenum++;
}