Merge branch 'stackpage' into 'master'

Stack page

See merge request GNOME/gtk!564
This commit is contained in:
Matthias Clasen 2019-02-08 05:22:30 +00:00
commit 4763406439
122 changed files with 7165 additions and 6568 deletions

View File

@ -1,4 +1,3 @@
<?xml version="1.0"?>
<interface>
<template class="DemoApplicationWindow" parent="GtkApplicationWindow">
<property name="title" translatable="yes">Application Class</property>
@ -25,8 +24,7 @@
</object>
</child>
<child>
<object class="GtkSeparatorToolItem">
</object>
<object class="GtkSeparatorToolItem"/>
</child>
<child>
<object class="GtkToolButton">

View File

@ -1,6 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.10 -->
<menu id="appmenu">
<section>
<item>

View File

@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkWindow" id="window">
@ -54,269 +53,275 @@
<property name="vhomogeneous">0</property>
<property name="transition-type">crossfade</property>
<child>
<object class="GtkGrid">
<property name="halign">center</property>
<property name="valign">center</property>
<property name="vexpand">1</property>
<property name="row-spacing">12</property>
<property name="column-spacing">12</property>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Duck</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Background</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkImage">
<style>
<class name="duck"/>
</style>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkImage">
<style>
<class name="gradient"/>
</style>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">
Blended picture</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkImage">
<property name="halign">center</property>
<style>
<class name="blend0"/>
</style>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
<property name="width">2</property>
</packing>
</child>
</object>
<packing>
<object class="GtkStackPage">
<property name="name">page0</property>
<property name="title" translatable="yes">Ducky</property>
</packing>
<property name="child">
<object class="GtkGrid">
<property name="halign">center</property>
<property name="valign">center</property>
<property name="vexpand">1</property>
<property name="row-spacing">12</property>
<property name="column-spacing">12</property>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Duck</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Background</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkImage">
<style>
<class name="duck"/>
</style>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkImage">
<style>
<class name="gradient"/>
</style>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">
Blended picture</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkImage">
<property name="halign">center</property>
<style>
<class name="blend0"/>
</style>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
<property name="width">2</property>
</packing>
</child>
</object>
</property>
</object>
</child>
<child>
<object class="GtkGrid">
<property name="halign">center</property>
<property name="valign">center</property>
<property name="vexpand">1</property>
<property name="row-spacing">12</property>
<property name="column-spacing">12</property>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Red</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Blue</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkImage">
<style>
<class name="red"/>
</style>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkImage">
<style>
<class name="blue"/>
</style>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">
Blended picture</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkImage">
<property name="halign">center</property>
<style>
<class name="blend1"/>
</style>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
<property name="width">2</property>
</packing>
</child>
</object>
<packing>
<object class="GtkStackPage">
<property name="name">page1</property>
<property name="title" translatable="yes">Blends</property>
</packing>
<property name="child">
<object class="GtkGrid">
<property name="halign">center</property>
<property name="valign">center</property>
<property name="vexpand">1</property>
<property name="row-spacing">12</property>
<property name="column-spacing">12</property>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Red</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Blue</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkImage">
<style>
<class name="red"/>
</style>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkImage">
<style>
<class name="blue"/>
</style>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">
Blended picture</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkImage">
<property name="halign">center</property>
<style>
<class name="blend1"/>
</style>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
<property name="width">2</property>
</packing>
</child>
</object>
</property>
</object>
</child>
<child>
<object class="GtkGrid">
<property name="halign">center</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
<property name="vexpand">1</property>
<property name="row-spacing">6</property>
<property name="column-spacing">12</property>
<child>
<object class="GtkImage">
<style>
<class name="cyan"/>
</style>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkImage">
<style>
<class name="magenta"/>
</style>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkImage">
<style>
<class name="yellow"/>
</style>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkImage">
<property name="halign">center</property>
<style>
<class name="blend2"/>
</style>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Cyan</property>
<property name="xalign">0</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Magenta</property>
<property name="xalign">0</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Yellow</property>
<property name="xalign">0</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Blended picture</property>
<property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</packing>
</child>
</object>
<packing>
<object class="GtkStackPage">
<property name="name">page2</property>
<property name="title" translatable="yes">CMYK</property>
</packing>
<property name="child">
<object class="GtkGrid">
<property name="halign">center</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
<property name="vexpand">1</property>
<property name="row-spacing">6</property>
<property name="column-spacing">12</property>
<child>
<object class="GtkImage">
<style>
<class name="cyan"/>
</style>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkImage">
<style>
<class name="magenta"/>
</style>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkImage">
<style>
<class name="yellow"/>
</style>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkImage">
<property name="halign">center</property>
<style>
<class name="blend2"/>
</style>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Cyan</property>
<property name="xalign">0</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Magenta</property>
<property name="xalign">0</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Yellow</property>
<property name="xalign">0</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Blended picture</property>
<property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"></attribute>
</attributes>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</packing>
</child>
</object>
</property>
</object>
</child>
</object>
<packing>
@ -326,7 +331,6 @@ Blended picture</property>
</child>
</object>
</child>
<child type="titlebar">
</child>
<child type="titlebar"/>
</object>
</interface>

View File

@ -1,6 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.94 -->
<object class="GdkCursor" id="default_cursor">
<property name="name">default</property>
</object>

View File

@ -1,5 +1,3 @@
<?xml version="1.0" standalone="no"?>
<!--*- mode: xml -*-->
<interface>
<object class="GtkListStore" id="liststore1">
<columns>
@ -76,8 +74,7 @@
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem">
</object>
<object class="GtkSeparatorMenuItem"/>
</child>
<child>
<object class="GtkMenuItem" id="quit_item">
@ -174,8 +171,7 @@
</object>
</child>
<child>
<object class="GtkSeparatorToolItem">
</object>
<object class="GtkSeparatorToolItem"/>
</child>
<child>
<object class="GtkToolButton">
@ -254,8 +250,7 @@
</object>
</child>
<child>
<object class="GtkStatusbar" id="statusbar1">
</object>
<object class="GtkStatusbar" id="statusbar1"/>
</child>
</object>
</child>

View File

@ -1,12 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.1 -->
<interface>
<requires lib="gtk+" version="3.16"/>
<object class="GtkListStore" id="liststore1">
<columns>
<!-- column-name width -->
<column type="gint"/>
<!-- column-name height -->
<column type="gint"/>
</columns>
<data>
@ -43,7 +39,7 @@
<property name="label" translatable="yes">Original</property>
<property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
<attribute name="weight" value="bold"></attribute>
</attributes>
<accessibility>
<relation type="label-for" target="treeview1"/>
@ -149,7 +145,7 @@
<property name="label" translatable="yes">Computed Columns</property>
<property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
<attribute name="weight" value="bold"></attribute>
</attributes>
<accessibility>
<relation type="label-for" target="treeview2"/>
@ -165,7 +161,7 @@
<property name="label" translatable="yes">Filtered</property>
<property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
<attribute name="weight" value="bold"></attribute>
</attributes>
<accessibility>
<relation type="label-for" target="treeview3"/>

View File

@ -1,6 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.6 -->
<object class="GtkWindow" id="window">
<property name="title" translatable="yes">Fishbowl</property>
<child type="titlebar">
@ -69,8 +67,8 @@
</child>
<child>
<object class="GtkToggleButton" id="changes_prevent">
<property name="active" bind-source="changes_allow" bind-property="active" bind-flags="bidirectional|invert-boolean">True</property>
<property name="visible" bind-source="changes_prevent" bind-property="active" bind-flags="invert-boolean">False</property>
<property name="active" bind-source="changes_allow" bind-property="active" bind-flags="bidirectional|invert-boolean"/>
<property name="visible" bind-source="changes_prevent" bind-property="active" bind-flags="invert-boolean"/>
<property name="icon-name">changes-prevent</property>
<property name="relief">none</property>
</object>
@ -84,7 +82,7 @@
<object class="GtkFishbowl" id="bowl">
<property name="visible">True</property>
<property name="animating">True</property>
<property name="benchmark" bind-source="changes_allow" bind-property="active" bind-flags="invert-boolean">True</property>
<property name="benchmark" bind-source="changes_allow" bind-property="active" bind-flags="invert-boolean"/>
</object>
</child>
</object>

View File

@ -1,5 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.1 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<object class="GtkWindow" id="window">
@ -53,7 +51,7 @@
<property name="xalign">0</property>
<property name="label" translatable="yes">Font Features</property>
<attributes>
<attribute name="weight" value="bold"/>
<attribute name="weight" value="bold"></attribute>
</attributes>
</object>
</child>
@ -84,7 +82,7 @@
<property name="label" translatable="yes">Font Variations</property>
<property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
<attribute name="weight" value="bold"></attribute>
</attributes>
</object>
</child>
@ -115,31 +113,35 @@
<child>
<object class="GtkStack" id="stack">
<child>
<object class="GtkLabel" id="label">
<property name="wrap">1</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="valign">start</property>
<property name="selectable">1</property>
</object>
<packing>
<object class="GtkStackPage">
<property name="name">label</property>
</packing>
<property name="child">
<object class="GtkLabel" id="label">
<property name="wrap">1</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="valign">start</property>
<property name="selectable">1</property>
</object>
</property>
</object>
</child>
<child>
<object class="GtkEntry" id="entry">
<property name="text">Grumpy wizards make toxic brew for the evil Queen and Jack. A quick movement of the enemy will jeopardize six gunboats. The job of waxing linoleum frequently peeves chintzy kids. My girl wove six dozen plaid jackets before she quit. Twelve ziggurats quickly jumped a finch box.
<object class="GtkStackPage">
<property name="name">entry</property>
<property name="child">
<object class="GtkEntry" id="entry">
<property name="text">Grumpy wizards make toxic brew for the evil Queen and Jack. A quick movement of the enemy will jeopardize six gunboats. The job of waxing linoleum frequently peeves chintzy kids. My girl wove six dozen plaid jackets before she quit. Twelve ziggurats quickly jumped a finch box.
Разъяренный чтец эгоистично бьёт пятью жердями шустрого фехтовальщика. Наш банк вчера же выплатил Ф.Я. Эйхгольду комиссию за ценные вещи. Эх, чужак, общий съём цен шляп (юфть) вдрызг! В чащах юга жил бы цитрус? Да, но фальшивый экземпляр!
Τάχιστη αλώπηξ βαφής ψημένη γη, δρασκελίζει υπέρ νωθρού κυνός</property>
<signal name="activate" handler="stop_edit"/>
<property name="valign">start</property>
<property name="width-chars">50</property>
<signal name="activate" handler="stop_edit"/>
<property name="valign">start</property>
<property name="width-chars">50</property>
</object>
</property>
</object>
<packing>
<property name="name">entry</property>
</packing>
</child>
</object>
</child>

View File

@ -1,7 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="gtk40">
<!-- interface-requires gtk+ 3.10 -->
<!-- interface-requires gtkdemo 3.10 -->
<object class="GtkMenu" id="menu1">
<child>
<object class="GtkMenuItem" id="menuitem1">
@ -53,7 +50,7 @@
<property name="valign">baseline</property>
<property name="label" translatable="0">Username</property>
<attributes>
<attribute name="weight" value="bold"/>
<attribute name="weight" value="bold"></attribute>
</attributes>
</object>
</child>

View File

@ -1,22 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.10 -->
<object class="GtkTreeStore" id="treestore">
<columns>
<!-- column-name NAME -->
<column type="gchararray"/>
<!-- column-name TITLE -->
<column type="gchararray"/>
<!-- column-name FILENAME -->
<column type="gchararray"/>
<!-- column-name FUNC -->
<column type="gpointer"/>
<!-- column-name STYLE -->
<column type="gint"/>
</columns>
</object>
<object class="GtkApplicationWindow" id="window">
<style><class name="devel"/></style>
<style>
<class name="devel"/>
</style>
<property name="default-width">800</property>
<property name="default-height">600</property>
<property name="title">GTK Demo</property>

View File

@ -1,4 +1,3 @@
<?xml version="1.0"?>
<interface>
<menu id="appmenu">
<section>

View File

@ -1,6 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.6 -->
<object class="GtkWindow" id="window1">
<child type="titlebar">
<object class="GtkHeaderBar">
@ -56,7 +54,7 @@
<child>
<object class="GtkModelButton">
<property name="action-name">win.color</property>
<property name="action-target">'red'</property>
<property name="action-target">&apos;red&apos;</property>
<property name="text">Red</property>
<property name="inverted">1</property>
</object>
@ -64,7 +62,7 @@
<child>
<object class="GtkModelButton">
<property name="action-name">win.color</property>
<property name="action-target">'green'</property>
<property name="action-target">&apos;green&apos;</property>
<property name="text">Green</property>
<property name="inverted">1</property>
</object>
@ -72,7 +70,7 @@
<child>
<object class="GtkModelButton">
<property name="action-name">win.color</property>
<property name="action-target">'blue'</property>
<property name="action-target">&apos;blue&apos;</property>
<property name="text">Blue</property>
<property name="inverted">1</property>
</object>
@ -99,8 +97,7 @@
</object>
</child>
<child>
<object class="GtkSeparator">
</object>
<object class="GtkSeparator"/>
</child>
<child>
<object class="GtkModelButton">

View File

@ -1,10 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.16.0 on Wed Nov 13 16:45:55 2013 -->
<interface>
<!-- interface-requires gtk+ 3.10 -->
<object class="GtkListStore" id="liststore1">
<columns>
<!-- column-name Name -->
<column type="gchararray"/>
</columns>
<data>

View File

@ -1,6 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.6 -->
<object class="GtkWindow" id="window">
<property name="default-width">300</property>
<property name="default-height">300</property>

View File

@ -1,6 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.6 -->
<object class="GtkAdjustment" id="adjustment1">
<property name="upper">4</property>
<property name="value">2</property>
@ -76,11 +74,11 @@
<property name="adjustment">adjustment2</property>
<property name="hexpand">1</property>
<marks>
<mark value="0" position="bottom"></mark>
<mark value="1" position="bottom"></mark>
<mark value="2" position="bottom"></mark>
<mark value="3" position="bottom"></mark>
<mark value="4" position="bottom"></mark>
<mark value="0" position="bottom"/>
<mark value="1" position="bottom"/>
<mark value="2" position="bottom"/>
<mark value="3" position="bottom"/>
<mark value="4" position="bottom"/>
</marks>
<accessibility>
<relation type="labelled-by" target="label_marks"/>
@ -116,11 +114,11 @@
<relation type="labelled-by" target="label_discrete"/>
</accessibility>
<marks>
<mark value="0" position="bottom"></mark>
<mark value="1" position="bottom"></mark>
<mark value="2" position="bottom"></mark>
<mark value="3" position="bottom"></mark>
<mark value="4" position="bottom"></mark>
<mark value="0" position="bottom"/>
<mark value="1" position="bottom"/>
<mark value="2" position="bottom"/>
<mark value="3" position="bottom"/>
<mark value="4" position="bottom"/>
</marks>
</object>
<packing>

View File

@ -1,13 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.17 -->
<object class="GtkShortcutsWindow" id="shortcuts-boxes">
<property name="modal">1</property>
<child>
<object class="GtkShortcutsSection">
<property name="section-name">shortcuts</property>
<property name="max-height">12</property>
<!-- Overview shortcuts -->
<child>
<object class="GtkShortcutsGroup">
<property name="title" translatable="yes">Overview</property>
@ -44,12 +41,10 @@
</child>
</object>
</child>
<!-- Wizard and Properties shortcuts -->
<child>
<object class="GtkShortcutsGroup">
<property name="title" translatable="yes">Box Creation and Properties</property>
<property name="view">wizard</property>
<!-- LTR -->
<child>
<object class="GtkShortcutsShortcut">
<property name="direction">ltr</property>
@ -64,7 +59,6 @@
<property name="title" translatable="yes">Switch to the previous page</property>
</object>
</child>
<!-- RTL -->
<child>
<object class="GtkShortcutsShortcut">
<property name="direction">rtl</property>
@ -81,7 +75,6 @@
</child>
</object>
</child>
<!-- Display shortcuts -->
<child>
<object class="GtkShortcutsGroup">
<property name="title" translatable="yes">Box Display</property>
@ -92,7 +85,6 @@
<property name="title" translatable="yes">Grab/Ungrab keyboard</property>
</object>
</child>
<!-- LTR -->
<child>
<object class="GtkShortcutsShortcut">
<property name="direction">ltr</property>
@ -100,7 +92,6 @@
<property name="title" translatable="yes">Back to overview</property>
</object>
</child>
<!-- RTL -->
<child>
<object class="GtkShortcutsShortcut">
<property name="direction">rtl</property>

View File

@ -1,6 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.17 -->
<object class="GtkShortcutsWindow" id="shortcuts-builder">
<property name="modal">1</property>
<child>

View File

@ -1,6 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.17 -->
<object class="GtkShortcutsWindow" id="shortcuts-clocks">
<property name="modal">1</property>
<child>

View File

@ -1,6 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.17 -->
<object class="GtkShortcutsWindow" id="shortcuts-gedit">
<property name="modal">1</property>
<child>

View File

@ -1,6 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.17 -->
<object class="GtkWindow" id="window1">
<property name="title" translatable="yes">Shortcuts</property>
<child>

View File

@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkAdjustment" id="basic_adjustment">
<property name="lower">-10000</property>

View File

@ -1,6 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.6 -->
<object class="GtkWindow" id="window1">
<property name="title" translatable="yes">Stack</property>
<child>
@ -20,38 +18,44 @@
<property name="can-focus">1</property>
<property name="transition-type">crossfade</property>
<child>
<object class="GtkImage">
<property name="margin-top">20</property>
<property name="margin-bottom">20</property>
<property name="icon-name">gtk3-demo</property>
</object>
<packing>
<object class="GtkStackPage">
<property name="name">page1</property>
<property name="title" translatable="yes">Page 1</property>
</packing>
<property name="child">
<object class="GtkImage">
<property name="margin-top">20</property>
<property name="margin-bottom">20</property>
<property name="icon-name">gtk3-demo</property>
</object>
</property>
</object>
</child>
<child>
<object class="GtkCheckButton">
<property name="label" translatable="yes">Page 2</property>
<property name="can-focus">1</property>
<property name="halign">center</property>
<property name="valign">center</property>
</object>
<packing>
<object class="GtkStackPage">
<property name="name">page2</property>
<property name="title" translatable="yes">Page 2</property>
</packing>
<property name="child">
<object class="GtkCheckButton">
<property name="label" translatable="yes">Page 2</property>
<property name="can-focus">1</property>
<property name="halign">center</property>
<property name="valign">center</property>
</object>
</property>
</object>
</child>
<child>
<object class="GtkSpinner">
<property name="halign">center</property>
<property name="valign">center</property>
<property name="active">1</property>
</object>
<packing>
<object class="GtkStackPage">
<property name="name">page3</property>
<property name="icon-name">face-laugh-symbolic</property>
</packing>
<property name="child">
<object class="GtkSpinner">
<property name="halign">center</property>
<property name="valign">center</property>
<property name="active">1</property>
</object>
</property>
</object>
</child>
</object>
<packing>

View File

@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkGrid" id="grid">
<property name="row-spacing">10</property>

View File

@ -1,6 +1,4 @@
<?xml version="1.0"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<menu id="app-menu">
<section>
<item>

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.8 -->
<object class="IconStore" id="store"/>
<object class="GtkTreeModelFilter" id="filter_model">
<property name="child-model">store</property>
</object>
<template class="IconBrowserWindow" parent="GtkApplicationWindow">
<style><class name="devel"/></style>
<style>
<class name="devel"/>
</style>
<property name="title" translatable="yes">Icon Browser</property>
<property name="default-width">1024</property>
<property name="default-height">768</property>

View File

@ -556,7 +556,7 @@ set_needs_attention (GtkWidget *page, gboolean needs_attention)
GtkWidget *stack;
stack = gtk_widget_get_parent (page);
gtk_container_child_set (GTK_CONTAINER (stack), page,
g_object_set (gtk_stack_get_page (GTK_STACK (stack), page),
"needs-attention", needs_attention,
NULL);
}

File diff suppressed because it is too large Load Diff

View File

@ -79,6 +79,10 @@
<term><option>--replace</option></term>
<listitem><para>Write the content back to the .ui file instead of stdout.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--3to4</option></term>
<listitem><para>Transform a GTK 3 ui file to GTK 4</para></listitem>
</varlistentry>
</variablelist>
</refsect1>

View File

@ -211,8 +211,11 @@ gtk_adjustment_get_type
<FILE>gtkassistant</FILE>
<TITLE>GtkAssistant</TITLE>
GtkAssistant
GtkAssistantPage
GtkAssistantClass
gtk_assistant_new
gtk_assistant_get_page
gtk_assistant_page_get_child
gtk_assistant_get_current_page
gtk_assistant_set_current_page
gtk_assistant_get_n_pages
@ -6242,10 +6245,13 @@ gtk_header_bar_get_type
<FILE>gtkstack</FILE>
<TITLE>GtkStack</TITLE>
GtkStack
GtkStackPage
gtk_stack_new
gtk_stack_add_named
gtk_stack_add_titled
gtk_stack_get_child_by_name
gtk_stack_get_page
gtk_stack_page_get_child
gtk_stack_set_visible_child
gtk_stack_get_visible_child
gtk_stack_set_visible_child_name

View File

@ -14,6 +14,7 @@ gtk_application_get_type
gtk_application_window_get_type
gtk_aspect_frame_get_type
gtk_assistant_get_type
gtk_assistant_page_get_type
gtk_bin_get_type
gtk_box_get_type
gtk_builder_get_type
@ -155,6 +156,7 @@ gtk_snapshot_get_type
gtk_spin_button_get_type
gtk_spinner_get_type
gtk_stack_get_type
gtk_stack_page_get_type
gtk_stack_sidebar_get_type
gtk_stack_switcher_get_type
gtk_statusbar_get_type

View File

@ -305,6 +305,21 @@
</para>
</section>
<section>
<title>Stop using GtkButtonBox</title>
<para>
GtkButtonBox has been removed. Use a GtkBox instead.
</para>
</section>
<section>
<title>Adapt to GtkButton API changes</title>
<para>
GtkBox no longer has pack-start and -end. Pack your widgets in the
correct order, or reorder them as necessary.
</para>
</section>
<section>
<title>Adapt to GtkHeaderBar API changes</title>
<para>
@ -314,6 +329,17 @@
</para>
</section>
<section>
<title>Adapt to GtkStack API changes</title>
<para>
The GtkStack child properties have been converted into child meta object.
Instead of gtk_container_child_set (stack, child, …), you can now use
g_object_set (gtk_stack_get_page (stack, child), …). In .ui files, the
GtkStackPage objects must be created explicitly, and take the child widget
as property. gtk4-builder-tool can help with this conversion.
</para>
</section>
<section>
<title>Adapt to GtkStyleContext API changes</title>
<para>
@ -559,6 +585,14 @@
</para>
</section>
<section>
<title>Convert .ui files</title>
<para>
The simplify command of gtk4-builder-tool has gained a --3to4 option, which
can help with some of the required changes in .ui files, such as converting
child properties to child meta objects.
</para>
</section>
</section>
</chapter>

View File

@ -1,6 +1,4 @@
<?xml version="1.0"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<menu id="appmenu">
<section>
<item>

View File

@ -1,6 +1,4 @@
<?xml version="1.0"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<menu id="menu">
<section>
<item>

View File

@ -1,10 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.8 -->
<template class="ExampleAppPrefs" parent="GtkDialog">
<property name="title" translatable="yes">Preferences</property>
<property name="resizable">False</property>
<property name="modal">True</property>
<property name="resizable">0</property>
<property name="modal">1</property>
<child internal-child="vbox">
<object class="GtkBox" id="vbox">
<child>
@ -25,8 +23,7 @@
</packing>
</child>
<child>
<object class="GtkFontButton" id="font">
</object>
<object class="GtkFontButton" id="font"/>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>

View File

@ -1,6 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.8 -->
<template class="ExampleAppWindow" parent="GtkApplicationWindow">
<property name="title" translatable="yes">Example Application</property>
<property name="default-width">600</property>

View File

@ -1,6 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.8 -->
<template class="ExampleAppWindow" parent="GtkApplicationWindow">
<property name="title" translatable="yes">Example Application</property>
<property name="default-width">600</property>
@ -18,8 +16,7 @@
</object>
</child>
<child>
<object class="GtkStack" id="stack">
</object>
<object class="GtkStack" id="stack"/>
</child>
</object>
</child>

View File

@ -1,6 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.8 -->
<template class="ExampleAppWindow" parent="GtkApplicationWindow">
<property name="title" translatable="yes">Example Application</property>
<property name="default-width">600</property>
@ -18,8 +16,7 @@
</object>
</child>
<child>
<object class="GtkStack" id="stack">
</object>
<object class="GtkStack" id="stack"/>
</child>
</object>
</child>

View File

@ -1,6 +1,4 @@
<?xml version="1.0"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<menu id="appmenu">
<section>
<item>

View File

@ -1,6 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.8 -->
<template class="ExampleAppWindow" parent="GtkApplicationWindow">
<property name="title" translatable="yes">Example Application</property>
<property name="default-width">600</property>
@ -18,8 +16,7 @@
</object>
</child>
<child>
<object class="GtkStack" id="stack">
</object>
<object class="GtkStack" id="stack"/>
</child>
</object>
</child>

View File

@ -1,6 +1,4 @@
<?xml version="1.0"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<menu id="appmenu">
<section>
<item>

View File

@ -1,6 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.8 -->
<template class="ExampleAppWindow" parent="GtkApplicationWindow">
<property name="title" translatable="yes">Example Application</property>
<property name="default-width">600</property>
@ -18,8 +16,7 @@
</object>
</child>
<child>
<object class="GtkStack" id="stack">
</object>
<object class="GtkStack" id="stack"/>
</child>
</object>
</child>

View File

@ -1,6 +1,4 @@
<?xml version="1.0"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<menu id="appmenu">
<section>
<item>

View File

@ -1,10 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.8 -->
<template class="ExampleAppPrefs" parent="GtkDialog">
<property name="title" translatable="yes">Preferences</property>
<property name="resizable">False</property>
<property name="modal">True</property>
<property name="resizable">0</property>
<property name="modal">1</property>
<child internal-child="vbox">
<object class="GtkBox" id="vbox">
<child>
@ -25,8 +23,7 @@
</packing>
</child>
<child>
<object class="GtkFontButton" id="font">
</object>
<object class="GtkFontButton" id="font"/>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>

View File

@ -1,6 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.8 -->
<template class="ExampleAppWindow" parent="GtkApplicationWindow">
<property name="title" translatable="yes">Example Application</property>
<property name="default-width">600</property>
@ -18,8 +16,7 @@
</object>
</child>
<child>
<object class="GtkStack" id="stack">
</object>
<object class="GtkStack" id="stack"/>
</child>
</object>
</child>

View File

@ -1,6 +1,4 @@
<?xml version="1.0"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<menu id="appmenu">
<section>
<item>

View File

@ -1,10 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.8 -->
<template class="ExampleAppPrefs" parent="GtkDialog">
<property name="title" translatable="yes">Preferences</property>
<property name="resizable">False</property>
<property name="modal">True</property>
<property name="resizable">0</property>
<property name="modal">1</property>
<child internal-child="vbox">
<object class="GtkBox" id="vbox">
<child>
@ -25,8 +23,7 @@
</packing>
</child>
<child>
<object class="GtkFontButton" id="font">
</object>
<object class="GtkFontButton" id="font"/>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>

View File

@ -1,6 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.8 -->
<template class="ExampleAppWindow" parent="GtkApplicationWindow">
<property name="title" translatable="yes">Example Application</property>
<property name="default-width">600</property>

View File

@ -1,6 +1,4 @@
<?xml version="1.0"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<menu id="appmenu">
<section>
<item>

View File

@ -1,6 +1,4 @@
<?xml version="1.0"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<menu id="menu">
<section>
<item>

View File

@ -1,10 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.8 -->
<template class="ExampleAppPrefs" parent="GtkDialog">
<property name="title" translatable="yes">Preferences</property>
<property name="resizable">False</property>
<property name="modal">True</property>
<property name="resizable">0</property>
<property name="modal">1</property>
<child internal-child="vbox">
<object class="GtkBox" id="vbox">
<child>
@ -25,8 +23,7 @@
</packing>
</child>
<child>
<object class="GtkFontButton" id="font">
</object>
<object class="GtkFontButton" id="font"/>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>

View File

@ -1,6 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.8 -->
<template class="ExampleAppWindow" parent="GtkApplicationWindow">
<property name="title" translatable="yes">Example Application</property>
<property name="default-width">600</property>

View File

@ -1,6 +1,4 @@
<?xml version="1.0"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<menu id="appmenu">
<section>
<item>

View File

@ -1,6 +1,4 @@
<?xml version="1.0"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<menu id="menu">
<section>
<item>

View File

@ -1,10 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.8 -->
<template class="ExampleAppPrefs" parent="GtkDialog">
<property name="title" translatable="yes">Preferences</property>
<property name="resizable">False</property>
<property name="modal">True</property>
<property name="resizable">0</property>
<property name="modal">1</property>
<child internal-child="vbox">
<object class="GtkBox" id="vbox">
<child>
@ -25,8 +23,7 @@
</packing>
</child>
<child>
<object class="GtkFontButton" id="font">
</object>
<object class="GtkFontButton" id="font"/>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>

View File

@ -1,6 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.8 -->
<template class="ExampleAppWindow" parent="GtkApplicationWindow">
<property name="title" translatable="yes">Example Application</property>
<property name="default-width">600</property>

View File

@ -41,6 +41,10 @@
* handling buttons, you can use the #GTK_ASSISTANT_PAGE_CUSTOM page
* type and handle buttons yourself.
*
* GtkAssistant maintains a #GtkAssistantPage object for each added
* child, which holds additional per-child properties. You
* obtain the #GtkAssistantPage for a child with gtk_assistant_get_page().
*
* # GtkAssistant as GtkBuildable
*
* The GtkAssistant implementation of the #GtkBuildable interface
@ -48,8 +52,9 @@
* action_area.
*
* To add pages to an assistant in #GtkBuilder, simply add it as a
* child to the GtkAssistant object, and set its child properties
* as necessary.
* child to the GtkAssistant object. If you need to set per-object
* properties, create a #GtkAssistantPage object explicitly, and
* set the child widget as a property on it.
*
* # CSS nodes
*
@ -79,10 +84,9 @@
#include "a11y/gtkwindowaccessible.h"
typedef struct _GtkAssistantPage GtkAssistantPage;
struct _GtkAssistantPage
{
GObject instance;
GtkAssistantPageType type;
guint complete : 1;
guint complete_set : 1;
@ -96,6 +100,11 @@ struct _GtkAssistantPage
GtkWidget *current_title;
};
struct _GtkAssistantPageClass
{
GObjectClass parent_class;
};
struct _GtkAssistantPrivate
{
GtkWidget *cancel;
@ -137,18 +146,20 @@ static void gtk_assistant_add (GtkContainer *container,
GtkWidget *page);
static void gtk_assistant_remove (GtkContainer *container,
GtkWidget *page);
static void gtk_assistant_set_child_property (GtkContainer *container,
GtkWidget *child,
static void gtk_assistant_page_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gtk_assistant_get_child_property (GtkContainer *container,
GtkWidget *child,
static void gtk_assistant_page_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gtk_assistant_buildable_interface_init (GtkBuildableIface *iface);
static void gtk_assistant_buildable_add_child (GtkBuildable *buildable,
GtkBuilder *builder,
GObject *child,
const char *type);
static gboolean gtk_assistant_buildable_custom_tag_start (GtkBuildable *buildable,
GtkBuilder *builder,
GObject *child,
@ -180,17 +191,107 @@ static void assistant_remove_page_cb (GtkContainer *con
GtkWidget *page,
GtkAssistant *assistant);
static int gtk_assistant_add_page (GtkAssistant *assistant,
GtkAssistantPage *page_info,
gint position);
GType _gtk_assistant_accessible_get_type (void);
enum
{
CHILD_PROP_0,
CHILD_PROP_CHILD,
CHILD_PROP_PAGE_TYPE,
CHILD_PROP_PAGE_TITLE,
CHILD_PROP_PAGE_COMPLETE,
CHILD_PROP_HAS_PADDING
};
G_DEFINE_TYPE (GtkAssistantPage, gtk_assistant_page, G_TYPE_OBJECT)
static void
gtk_assistant_page_init (GtkAssistantPage *page)
{
page->type = GTK_ASSISTANT_PAGE_CONTENT;
}
static void
gtk_assistant_page_finalize (GObject *object)
{
GtkAssistantPage *page = GTK_ASSISTANT_PAGE (object);
g_clear_object (&page->page);
g_free (page->title);
G_OBJECT_CLASS (gtk_assistant_page_parent_class)->finalize (object);
}
static void
gtk_assistant_page_class_init (GtkAssistantPageClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
object_class->finalize = gtk_assistant_page_finalize;
object_class->get_property = gtk_assistant_page_get_property;
object_class->set_property = gtk_assistant_page_set_property;
/**
* GtkAssistantPage:page-type:
*
* The type of the assistant page.
*/
g_object_class_install_property (object_class,
CHILD_PROP_PAGE_TYPE,
g_param_spec_enum ("page-type",
P_("Page type"),
P_("The type of the assistant page"),
GTK_TYPE_ASSISTANT_PAGE_TYPE,
GTK_ASSISTANT_PAGE_CONTENT,
GTK_PARAM_READWRITE));
/**
* GtkAssistantPage:title:
*
* The title of the page.
*/
g_object_class_install_property (object_class,
CHILD_PROP_PAGE_TITLE,
g_param_spec_string ("title",
P_("Page title"),
P_("The title of the assistant page"),
NULL,
GTK_PARAM_READWRITE));
/**
* GtkAssistantPage:complete:
*
* Setting the "complete" property to %TRUE marks a page as
* complete (i.e.: all the required fields are filled out). GTK+ uses
* this information to control the sensitivity of the navigation buttons.
*/
g_object_class_install_property (object_class,
CHILD_PROP_PAGE_COMPLETE,
g_param_spec_boolean ("complete",
P_("Page complete"),
P_("Whether all required fields on the page have been filled out"),
FALSE,
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
CHILD_PROP_HAS_PADDING,
g_param_spec_boolean ("has-padding",
P_("Has padding"),
P_("Whether the assistant adds padding around the page"),
TRUE,
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
CHILD_PROP_CHILD,
g_param_spec_object ("child",
P_("Child widget"),
P_("The content the assistant page"),
GTK_TYPE_WIDGET,
GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
}
enum
{
CANCEL,
@ -395,8 +496,6 @@ gtk_assistant_class_init (GtkAssistantClass *class)
container_class->add = gtk_assistant_add;
container_class->remove = gtk_assistant_remove;
container_class->set_child_property = gtk_assistant_set_child_property;
container_class->get_child_property = gtk_assistant_get_child_property;
window_class->close_request = gtk_assistant_close_request;
@ -506,51 +605,6 @@ gtk_assistant_class_init (GtkAssistantClass *class)
-1, 1, -1,
GTK_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY));
/**
* GtkAssistant:page-type:
*
* The type of the assistant page.
*/
gtk_container_class_install_child_property (container_class,
CHILD_PROP_PAGE_TYPE,
g_param_spec_enum ("page-type",
P_("Page type"),
P_("The type of the assistant page"),
GTK_TYPE_ASSISTANT_PAGE_TYPE,
GTK_ASSISTANT_PAGE_CONTENT,
GTK_PARAM_READWRITE));
/**
* GtkAssistant:title:
*
* The title of the page.
*/
gtk_container_class_install_child_property (container_class,
CHILD_PROP_PAGE_TITLE,
g_param_spec_string ("title",
P_("Page title"),
P_("The title of the assistant page"),
NULL,
GTK_PARAM_READWRITE));
/**
* GtkAssistant:complete:
*
* Setting the "complete" child property to %TRUE marks a page as
* complete (i.e.: all the required fields are filled out). GTK+ uses
* this information to control the sensitivity of the navigation buttons.
*/
gtk_container_class_install_child_property (container_class,
CHILD_PROP_PAGE_COMPLETE,
g_param_spec_boolean ("complete",
P_("Page complete"),
P_("Whether all required fields on the page have been filled out"),
FALSE,
G_PARAM_READWRITE));
gtk_container_class_install_child_property (container_class, CHILD_PROP_HAS_PADDING,
g_param_spec_boolean ("has-padding", P_("Has padding"), P_("Whether the assistant adds padding around the page"),
TRUE, G_PARAM_READWRITE));
/* Bind class to template
*/
@ -1019,9 +1073,9 @@ alternative_button_order (GtkAssistant *assistant)
}
static void
on_page_notify (GtkWidget *widget,
GParamSpec *arg,
gpointer data)
on_page_page_notify (GtkWidget *widget,
GParamSpec *arg,
gpointer data)
{
GtkAssistant *assistant = GTK_ASSISTANT (data);
@ -1032,6 +1086,15 @@ on_page_notify (GtkWidget *widget,
}
}
static void
on_page_notify (GtkAssistantPage *page,
GParamSpec *arg,
gpointer data)
{
if (page->page)
on_page_page_notify (page->page, arg, data);
}
static void
assistant_remove_page_cb (GtkContainer *container,
GtkWidget *page,
@ -1072,7 +1135,8 @@ assistant_remove_page_cb (GtkContainer *container,
}
}
g_signal_handlers_disconnect_by_func (page_info->page, on_page_notify, assistant);
g_signal_handlers_disconnect_by_func (page_info->page, on_page_page_notify, assistant);
g_signal_handlers_disconnect_by_func (page_info, on_page_notify, assistant);
gtk_size_group_remove_widget (priv->title_size_group, page_info->regular_title);
gtk_size_group_remove_widget (priv->title_size_group, page_info->current_title);
@ -1083,9 +1147,8 @@ assistant_remove_page_cb (GtkContainer *container,
priv->pages = g_list_remove_link (priv->pages, element);
priv->visited_pages = g_slist_remove_all (priv->visited_pages, page_info);
g_free (page_info->title);
g_object_unref (page_info);
g_slice_free (GtkAssistantPage, page_info);
g_list_free_1 (element);
if (gtk_widget_get_mapped (GTK_WIDGET (assistant)))
@ -1132,65 +1195,121 @@ gtk_assistant_init (GtkAssistant *assistant)
}
static void
gtk_assistant_set_child_property (GtkContainer *container,
GtkWidget *child,
guint property_id,
const GValue *value,
GParamSpec *pspec)
gtk_assistant_page_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
GtkAssistantPage *page = GTK_ASSISTANT_PAGE (object);
GtkWidget *assistant = NULL;
if (page->page)
assistant = gtk_widget_get_ancestor (page->page, GTK_TYPE_ASSISTANT);
switch (property_id)
{
case CHILD_PROP_CHILD:
g_set_object (&page->page, g_value_get_object (value));
break;
case CHILD_PROP_PAGE_TYPE:
gtk_assistant_set_page_type (GTK_ASSISTANT (container), child,
g_value_get_enum (value));
if (page->type != g_value_get_enum (value))
{
page->type = g_value_get_enum (value);
/* backwards compatibility to the era before fixing bug 604289 */
if (page->type == GTK_ASSISTANT_PAGE_SUMMARY && !page->complete_set)
{
page->complete = TRUE;
page->complete_set = FALSE;
}
/* Always set buttons state, a change in a future page
* might change current page buttons
*/
if (assistant)
update_buttons_state (GTK_ASSISTANT (assistant));
g_object_notify (G_OBJECT (page), "page-type");
}
break;
case CHILD_PROP_PAGE_TITLE:
gtk_assistant_set_page_title (GTK_ASSISTANT (container), child,
g_value_get_string (value));
g_free (page->title);
page->title = g_value_dup_string (value);
if (assistant)
{
gtk_label_set_text ((GtkLabel*) page->regular_title, page->title);
gtk_label_set_text ((GtkLabel*) page->current_title, page->title);
update_title_state (GTK_ASSISTANT (assistant));
}
g_object_notify (G_OBJECT (page), "title");
break;
case CHILD_PROP_PAGE_COMPLETE:
gtk_assistant_set_page_complete (GTK_ASSISTANT (container), child,
g_value_get_boolean (value));
if (page->complete != g_value_get_boolean (value))
{
page->complete = g_value_get_boolean (value);
page->complete_set = TRUE;
/* Always set buttons state, a change in a future page
* might change current page buttons
*/
if (assistant)
update_buttons_state (GTK_ASSISTANT (assistant));
g_object_notify (G_OBJECT (page), "complete");
}
break;
case CHILD_PROP_HAS_PADDING:
gtk_assistant_set_page_has_padding (GTK_ASSISTANT (container), child,
g_value_get_boolean (value));
if (page->has_padding != g_value_get_boolean (value))
{
page->has_padding = g_value_get_boolean (value);
g_object_set (page->box, "margin", page->has_padding ? 12 : 0, NULL);
g_object_notify (G_OBJECT (page), "has-padding");
}
break;
default:
GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
gtk_assistant_get_child_property (GtkContainer *container,
GtkWidget *child,
guint property_id,
GValue *value,
GParamSpec *pspec)
gtk_assistant_page_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
GtkAssistant *assistant = GTK_ASSISTANT (container);
GtkAssistantPage *page = GTK_ASSISTANT_PAGE (object);
switch (property_id)
{
case CHILD_PROP_CHILD:
g_value_set_object (value, page->page);
break;
case CHILD_PROP_PAGE_TYPE:
g_value_set_enum (value,
gtk_assistant_get_page_type (assistant, child));
g_value_set_enum (value, page->type);
break;
case CHILD_PROP_PAGE_TITLE:
g_value_set_string (value,
gtk_assistant_get_page_title (assistant, child));
g_value_set_string (value, page->title);
break;
case CHILD_PROP_PAGE_COMPLETE:
g_value_set_boolean (value,
gtk_assistant_get_page_complete (assistant, child));
g_value_set_boolean (value, page->complete);
break;
case CHILD_PROP_HAS_PADDING:
g_value_set_boolean (value,
gtk_assistant_get_page_has_padding (assistant, child));
g_value_set_boolean (value, page->has_padding);
break;
default:
GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
@ -1342,13 +1461,14 @@ gtk_assistant_add (GtkContainer *container,
* For the first invocation (from the builder template invocation),
* let's make sure we add the actual direct container content properly.
*/
if (!gtk_bin_get_child (GTK_BIN (container)))
if (!GTK_ASSISTANT (container)->priv->constructed)
{
gtk_widget_set_parent (page, GTK_WIDGET (container));
_gtk_bin_set_child (GTK_BIN (container), page);
return;
}
g_print ("after template init\n");
gtk_assistant_append_page (GTK_ASSISTANT (container), page);
}
@ -1639,25 +1759,33 @@ gtk_assistant_insert_page (GtkAssistant *assistant,
GtkWidget *page,
gint position)
{
GtkAssistantPrivate *priv;
GtkAssistantPage *page_info;
gint n_pages;
GtkStyleContext *context;
GtkWidget *box;
GtkWidget *sibling;
g_return_val_if_fail (GTK_IS_ASSISTANT (assistant), 0);
g_return_val_if_fail (GTK_IS_WIDGET (page), 0);
g_return_val_if_fail (gtk_widget_get_parent (page) == NULL, 0);
g_return_val_if_fail (!gtk_widget_is_toplevel (page), 0);
priv = assistant->priv;
page_info = g_slice_new0 (GtkAssistantPage);
page_info->page = page;
page_info->regular_title = gtk_label_new (NULL);
page_info = g_object_new (GTK_TYPE_ASSISTANT_PAGE, NULL);
page_info->page = g_object_ref (page);
page_info->has_padding = TRUE;
page_info->current_title = gtk_label_new (NULL);
return gtk_assistant_add_page (assistant, page_info, position);
}
static int
gtk_assistant_add_page (GtkAssistant *assistant,
GtkAssistantPage *page_info,
gint position)
{
GtkAssistantPrivate *priv = assistant->priv;
gint n_pages;
GtkStyleContext *context;
GtkWidget *box;
GtkWidget *sibling;
page_info->regular_title = gtk_label_new (page_info->title);
page_info->current_title = gtk_label_new (page_info->title);
gtk_label_set_xalign (GTK_LABEL (page_info->regular_title), 0.0);
gtk_label_set_xalign (GTK_LABEL (page_info->current_title), 0.0);
@ -1671,13 +1799,13 @@ gtk_assistant_insert_page (GtkAssistant *assistant,
gtk_size_group_add_widget (priv->title_size_group, page_info->regular_title);
gtk_size_group_add_widget (priv->title_size_group, page_info->current_title);
g_signal_connect (G_OBJECT (page), "notify::visible",
g_signal_connect (G_OBJECT (page_info->page), "notify::visible",
G_CALLBACK (on_page_page_notify), assistant);
g_signal_connect (G_OBJECT (page_info), "notify::page-title",
G_CALLBACK (on_page_notify), assistant);
g_signal_connect (G_OBJECT (page), "child-notify::page-title",
G_CALLBACK (on_page_notify), assistant);
g_signal_connect (G_OBJECT (page), "child-notify::page-type",
g_signal_connect (G_OBJECT (page_info), "notify::page-type",
G_CALLBACK (on_page_notify), assistant);
n_pages = g_list_length (priv->pages);
@ -1702,7 +1830,7 @@ gtk_assistant_insert_page (GtkAssistant *assistant,
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_show (box);
gtk_container_add (GTK_CONTAINER (box), page);
gtk_container_add (GTK_CONTAINER (box), page_info->page);
g_object_set (box, "margin", 12, NULL);
g_signal_connect (box, "remove", G_CALLBACK (assistant_remove_page_cb), assistant);
@ -1893,15 +2021,7 @@ gtk_assistant_set_page_title (GtkAssistant *assistant,
page_info = (GtkAssistantPage*) child->data;
g_free (page_info->title);
page_info->title = g_strdup (title);
gtk_label_set_text ((GtkLabel*) page_info->regular_title, title);
gtk_label_set_text ((GtkLabel*) page_info->current_title, title);
update_title_state (assistant);
gtk_container_child_notify (GTK_CONTAINER (assistant), page, "title");
g_object_set (page_info, "title", title, NULL);
}
/**
@ -1959,24 +2079,7 @@ gtk_assistant_set_page_type (GtkAssistant *assistant,
page_info = (GtkAssistantPage*) child->data;
if (type != page_info->type)
{
page_info->type = type;
/* backwards compatibility to the era before fixing bug 604289 */
if (type == GTK_ASSISTANT_PAGE_SUMMARY && !page_info->complete_set)
{
gtk_assistant_set_page_complete (assistant, page, TRUE);
page_info->complete_set = FALSE;
}
/* Always set buttons state, a change in a future page
* might change current page buttons
*/
update_buttons_state (assistant);
gtk_container_child_notify (GTK_CONTAINER (assistant), page, "page-type");
}
g_object_set (page_info, "page-type", type, NULL);
}
/**
@ -2035,18 +2138,7 @@ gtk_assistant_set_page_complete (GtkAssistant *assistant,
page_info = (GtkAssistantPage*) child->data;
if (complete != page_info->complete)
{
page_info->complete = complete;
page_info->complete_set = TRUE;
/* Always set buttons state, a change in a future page
* might change current page buttons
*/
update_buttons_state (assistant);
gtk_container_child_notify (GTK_CONTAINER (assistant), page, "complete");
}
g_object_set (page_info, "complete", complete, NULL);
}
/**
@ -2103,16 +2195,7 @@ gtk_assistant_set_page_has_padding (GtkAssistant *assistant,
page_info = (GtkAssistantPage*) child->data;
if (page_info->has_padding != has_padding)
{
page_info->has_padding = has_padding;
g_object_set (page_info->box,
"margin", has_padding ? 12 : 0,
NULL);
gtk_container_child_notify (GTK_CONTAINER (assistant), page, "has-padding");
}
g_object_set (page_info, "has-padding", has_padding, NULL);
}
/**
@ -2285,6 +2368,27 @@ gtk_assistant_buildable_interface_init (GtkBuildableIface *iface)
parent_buildable_iface = g_type_interface_peek_parent (iface);
iface->custom_tag_start = gtk_assistant_buildable_custom_tag_start;
iface->custom_finished = gtk_assistant_buildable_custom_finished;
iface->add_child = gtk_assistant_buildable_add_child;
}
static void
gtk_assistant_buildable_add_child (GtkBuildable *buildable,
GtkBuilder *builder,
GObject *child,
const char *type)
{
if (GTK_IS_ASSISTANT_PAGE (child))
gtk_assistant_add_page (GTK_ASSISTANT (buildable), GTK_ASSISTANT_PAGE (child), -1);
else if (type && g_str_equal (type, "titlebar"))
{
GtkAssistant *assistant = GTK_ASSISTANT (buildable);
assistant->priv->headerbar = GTK_WIDGET (child);
gtk_window_set_titlebar (GTK_WINDOW (buildable), assistant->priv->headerbar);
}
else if (GTK_IS_WIDGET (child))
gtk_container_add (GTK_CONTAINER (buildable), GTK_WIDGET (child));
else
g_warning ("Can't add a child of type '%s' to '%s'", G_OBJECT_TYPE_NAME (child), G_OBJECT_TYPE_NAME (buildable));
}
gboolean
@ -2309,3 +2413,36 @@ gtk_assistant_buildable_custom_finished (GtkBuildable *buildable,
parent_buildable_iface->custom_finished (buildable, builder, child,
tagname, user_data);
}
/**
* gtk_assistant_get_page:
* @assistant: a #GtkAssistant
* @child: a child of @assistant
*
* Returns the #GtkAssistantPage object for @child.
*
* Returns: (transfer none): the #GtkAssistantPage for @child
*/
GtkAssistantPage *
gtk_assistant_get_page (GtkAssistant *assistant,
GtkWidget *child)
{
GList *page_info = find_page (assistant, child);
return (GtkAssistantPage *) (page_info ? page_info->data : NULL);
}
/**
* gtk_assistant_page_get_child:
* @page: a #GtkAssistantPage
*
* Returns the child to which @page belongs.
*
* Returns: (transfer none): the child to which @page belongs
*/
GtkWidget *
gtk_assistant_page_get_child (GtkAssistantPage *page)
{
return page->page;
}

View File

@ -118,6 +118,16 @@ struct _GtkAssistantClass
void (*_gtk_reserved5) (void);
};
#define GTK_TYPE_ASSISTANT_PAGE (gtk_assistant_page_get_type ())
#define GTK_ASSISTANT_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ASSISTANT_PAGE, GtkAssistantPage))
#define GTK_ASSISTANT_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ASSISTANT_PAGE, GtkAssistantPageClass))
#define GTK_IS_ASSISTANT_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ASSISTANT_PAGE))
#define GTK_IS_ASSISTANT_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ASSISTANT_PAGE))
#define GTK_ASSISTANT_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ASSISTANT_PAGE, GtkAssistantPageClass))
typedef struct _GtkAssistantPage GtkAssistantPage;
typedef struct _GtkAssistantPageClass GtkAssistantPageClass;
/**
* GtkAssistantPageFunc:
* @current_page: The page number used to calculate the next page.
@ -132,6 +142,8 @@ struct _GtkAssistantClass
*/
typedef gint (*GtkAssistantPageFunc) (gint current_page, gpointer data);
GDK_AVAILABLE_IN_ALL
GType gtk_assistant_page_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GType gtk_assistant_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
@ -209,6 +221,12 @@ void gtk_assistant_set_page_has_padding (GtkAssistant *assista
GDK_AVAILABLE_IN_ALL
gboolean gtk_assistant_get_page_has_padding (GtkAssistant *assistant,
GtkWidget *page);
GDK_AVAILABLE_IN_ALL
GtkAssistantPage * gtk_assistant_get_page (GtkAssistant *assistant,
GtkWidget *child);
GDK_AVAILABLE_IN_ALL
GtkWidget * gtk_assistant_page_get_child (GtkAssistantPage *page);
G_END_DECLS

View File

@ -536,7 +536,7 @@ gtk_builder_get_parameters (GtkBuilder *builder,
(G_PARAM_SPEC_VALUE_TYPE (prop->pspec) != G_TYPE_FILE))
{
GObject *object = g_hash_table_lookup (priv->objects,
prop->text->str);
g_strstrip (prop->text->str));
if (object)
{
@ -722,7 +722,9 @@ _gtk_builder_construct (GtkBuilder *builder,
* be set once.
*/
if (info->constructor ||
(info->parent && ((ChildInfo*)info->parent)->internal_child != NULL))
(info->parent &&
info->parent->tag_type == TAG_CHILD &&
((ChildInfo*)info->parent)->internal_child != NULL))
param_filter_flags = G_PARAM_CONSTRUCT_ONLY;
else
param_filter_flags = G_PARAM_CONSTRUCT | G_PARAM_CONSTRUCT_ONLY;
@ -758,7 +760,9 @@ _gtk_builder_construct (GtkBuilder *builder,
if (construct_parameters->len)
g_warning ("Can't pass in construct-only parameters to %s", info->id);
}
else if (info->parent && ((ChildInfo*)info->parent)->internal_child != NULL)
else if (info->parent &&
info->parent->tag_type == TAG_CHILD &&
((ChildInfo*)info->parent)->internal_child != NULL)
{
gchar *childname = ((ChildInfo*)info->parent)->internal_child;
obj = gtk_builder_get_internal_child (builder, info, childname, error);

View File

@ -34,16 +34,6 @@
static void free_property_info (PropertyInfo *info);
static void free_object_info (ObjectInfo *info);
enum {
TAG_PROPERTY,
TAG_MENU,
TAG_REQUIRES,
TAG_OBJECT,
TAG_CHILD,
TAG_SIGNAL,
TAG_INTERFACE,
TAG_TEMPLATE,
};
static inline void
state_push (ParserData *data, gpointer info)
@ -1066,6 +1056,12 @@ end_element (GMarkupParseContext *context,
{
ObjectInfo *object_info = state_pop_info (data, ObjectInfo);
ChildInfo* child_info = state_peek_info (data, ChildInfo);
PropertyInfo* prop_info = state_peek_info (data, PropertyInfo);
if (child_info && child_info->tag_type != TAG_CHILD)
child_info = NULL;
if (prop_info && prop_info->tag_type != TAG_PROPERTY)
prop_info = NULL;
if (data->requested_objects && data->inside_requested_object &&
(data->cur_object_level == data->requested_object_level))
@ -1089,6 +1085,8 @@ end_element (GMarkupParseContext *context,
}
if (child_info)
child_info->object = object_info->object;
if (prop_info)
g_string_assign (prop_info->text, object_info->id);
if (GTK_IS_BUILDABLE (object_info->object) &&
GTK_BUILDABLE_GET_IFACE (object_info->object)->parser_finished)

View File

@ -21,6 +21,17 @@
#include "gtkbuilder.h"
enum {
TAG_PROPERTY,
TAG_MENU,
TAG_REQUIRES,
TAG_OBJECT,
TAG_CHILD,
TAG_SIGNAL,
TAG_INTERFACE,
TAG_TEMPLATE,
};
typedef struct {
guint tag_type;
} CommonInfo;

View File

@ -1877,4 +1877,3 @@ gtk_container_get_path_for_child (GtkContainer *container,
return path;
}

View File

@ -303,7 +303,7 @@ gtk_menu_section_box_insert_func (GtkMenuTrackerItem *item,
g_object_bind_property (item, "sensitive", widget, "sensitive", G_BINDING_SYNC_CREATE);
get_ancestors (GTK_WIDGET (box->toplevel), GTK_TYPE_STACK, &stack, &parent);
gtk_container_child_get (GTK_CONTAINER (stack), parent, "name", &name, NULL);
g_object_get (gtk_stack_get_page (GTK_STACK (stack), parent), "name", &name, NULL);
gtk_menu_section_box_new_submenu (item, box->toplevel, widget, name);
g_free (name);
}

View File

@ -52,8 +52,29 @@
* These animations respect the #GtkSettings:gtk-enable-animations
* setting.
*
* The GtkStack widget was added in GTK+ 3.10.
* GtkStack maintains a #GtkStackPage object for each added
* child, which holds additional per-child properties. You
* obtain the #GtkStackPage for a child with gtk_stack_get_page().
*
* # GtkStack as GtkBuildable
*
* To set child-specific properties in a .ui file, create GtkStackPage
* objects explictly, and set the child widget as a property on it:
* |[
* <object class="GtkStack" id="stack">
* <child>
* <object class="GtkStackPage">
* <property name="name">page1</property>
* <property name="title">In the beginning</property>
* <property name="child">
* <object class="GtkLabel">
* <property name="label">It was dark</property>
* </object>
* </property>
* </object>
* </child>
* ]|
*
* # CSS nodes
*
* GtkStack has a single CSS node named stack.
@ -92,6 +113,39 @@
* filter events out events to the last_child widget during transitions
*/
typedef struct {
GList *children;
GtkStackPage *visible_child;
gboolean hhomogeneous;
gboolean vhomogeneous;
GtkStackTransitionType transition_type;
guint transition_duration;
GtkStackPage *last_visible_child;
GskRenderNode *last_visible_node;
GtkAllocation last_visible_surface_allocation;
guint tick_id;
GtkProgressTracker tracker;
gboolean first_frame_skipped;
gint last_visible_widget_width;
gint last_visible_widget_height;
gboolean interpolate_size;
GtkStackTransitionType active_transition_type;
} GtkStackPrivate;
static void gtk_stack_buildable_interface_init (GtkBuildableIface *iface);
G_DEFINE_TYPE_WITH_CODE (GtkStack, gtk_stack, GTK_TYPE_CONTAINER,
G_ADD_PRIVATE (GtkStack)
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
gtk_stack_buildable_interface_init))
enum {
PROP_0,
PROP_HOMOGENEOUS,
@ -109,6 +163,7 @@ enum {
enum
{
CHILD_PROP_0,
CHILD_PROP_CHILD,
CHILD_PROP_NAME,
CHILD_PROP_TITLE,
CHILD_PROP_ICON_NAME,
@ -117,9 +172,8 @@ enum
LAST_CHILD_PROP
};
typedef struct _GtkStackChildInfo GtkStackChildInfo;
struct _GtkStackChildInfo {
struct _GtkStackPage {
GObject instance;
GtkWidget *widget;
gchar *name;
gchar *title;
@ -128,36 +182,223 @@ struct _GtkStackChildInfo {
GtkWidget *last_focus;
};
typedef struct {
GList *children;
GtkStackChildInfo *visible_child;
gboolean hhomogeneous;
gboolean vhomogeneous;
GtkStackTransitionType transition_type;
guint transition_duration;
GtkStackChildInfo *last_visible_child;
GskRenderNode *last_visible_node;
GtkAllocation last_visible_surface_allocation;
guint tick_id;
GtkProgressTracker tracker;
gboolean first_frame_skipped;
gint last_visible_widget_width;
gint last_visible_widget_height;
gboolean interpolate_size;
GtkStackTransitionType active_transition_type;
} GtkStackPrivate;
struct _GtkStackPageClass {
GObjectClass parent_class;
};
static GParamSpec *stack_props[LAST_PROP] = { NULL, };
static GParamSpec *stack_child_props[LAST_CHILD_PROP] = { NULL, };
G_DEFINE_TYPE (GtkStackPage, gtk_stack_page, G_TYPE_OBJECT)
static void
gtk_stack_page_init (GtkStackPage *page)
{
}
static void
gtk_stack_page_finalize (GObject *object)
{
GtkStackPage *page = GTK_STACK_PAGE (object);
g_clear_object (&page->widget);
g_free (page->name);
g_free (page->title);
g_free (page->icon_name);
if (page->last_focus)
g_object_remove_weak_pointer (G_OBJECT (page->last_focus),
(gpointer *)&page->last_focus);
G_OBJECT_CLASS (gtk_stack_page_parent_class)->finalize (object);
}
static void
gtk_stack_page_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
GtkStackPage *info = GTK_STACK_PAGE (object);
GtkWidget *stack = gtk_widget_get_parent (GTK_WIDGET (info->widget));
GtkStackPrivate *priv = gtk_stack_get_instance_private (GTK_STACK (stack));
switch (property_id)
{
case CHILD_PROP_CHILD:
g_value_set_object (value, info->widget);
break;
case CHILD_PROP_NAME:
g_value_set_string (value, info->name);
break;
case CHILD_PROP_TITLE:
g_value_set_string (value, info->title);
break;
case CHILD_PROP_ICON_NAME:
g_value_set_string (value, info->icon_name);
break;
case CHILD_PROP_POSITION:
g_value_set_int (value, g_list_index (priv->children, info));
break;
case CHILD_PROP_NEEDS_ATTENTION:
g_value_set_boolean (value, info->needs_attention);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void reorder_child (GtkStack *stack,
GtkWidget *child,
gint position);
static void
gtk_stack_page_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
GtkStackPage *info = GTK_STACK_PAGE (object);
GtkWidget *stack = NULL;
GtkStackPrivate *priv = NULL;
gchar *name;
GList *l;
if (info->widget)
{
stack = gtk_widget_get_parent (info->widget);
if (stack)
priv = gtk_stack_get_instance_private (GTK_STACK (stack));
}
switch (property_id)
{
case CHILD_PROP_CHILD:
g_set_object (&info->widget, g_value_get_object (value));
break;
case CHILD_PROP_NAME:
name = g_value_dup_string (value);
for (l = priv ? priv->children : NULL; l != NULL; l = l->next)
{
GtkStackPage *info2 = l->data;
if (info == info2)
continue;
if (g_strcmp0 (info2->name, name) == 0)
{
g_warning ("Duplicate child name in GtkStack: %s", name);
break;
}
}
g_free (info->name);
info->name = name;
g_object_notify_by_pspec (object, pspec);
if (priv && priv->visible_child == info)
g_object_notify_by_pspec (G_OBJECT (stack),
stack_props[PROP_VISIBLE_CHILD_NAME]);
break;
case CHILD_PROP_TITLE:
g_free (info->title);
info->title = g_value_dup_string (value);
g_object_notify_by_pspec (object, pspec);
break;
case CHILD_PROP_ICON_NAME:
g_free (info->icon_name);
info->icon_name = g_value_dup_string (value);
g_object_notify_by_pspec (object, pspec);
break;
case CHILD_PROP_POSITION:
if (stack)
reorder_child (GTK_STACK (stack), info->widget, g_value_get_int (value));
break;
case CHILD_PROP_NEEDS_ATTENTION:
info->needs_attention = g_value_get_boolean (value);
g_object_notify_by_pspec (object, pspec);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
gtk_stack_page_class_init (GtkStackPageClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
object_class->finalize = gtk_stack_page_finalize;
object_class->get_property = gtk_stack_page_get_property;
object_class->set_property = gtk_stack_page_set_property;
stack_child_props[CHILD_PROP_CHILD] =
g_param_spec_object ("child",
P_("Child"),
P_("The child of the page"),
GTK_TYPE_WIDGET,
GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
stack_child_props[CHILD_PROP_NAME] =
g_param_spec_string ("name",
P_("Name"),
P_("The name of the child page"),
NULL,
GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
stack_child_props[CHILD_PROP_TITLE] =
g_param_spec_string ("title",
P_("Title"),
P_("The title of the child page"),
NULL,
GTK_PARAM_READWRITE);
stack_child_props[CHILD_PROP_ICON_NAME] =
g_param_spec_string ("icon-name",
P_("Icon name"),
P_("The icon name of the child page"),
NULL,
GTK_PARAM_READWRITE);
stack_child_props[CHILD_PROP_POSITION] =
g_param_spec_int ("position",
P_("Position"),
P_("The index of the child in the parent"),
-1, G_MAXINT,
0,
GTK_PARAM_READWRITE);
/**
* GtkStack:needs-attention:
*
* Sets a flag specifying whether the child requires the user attention.
* This is used by the #GtkStackSwitcher to change the appearance of the
* corresponding button when a page needs attention and it is not the
* current one.
*/
stack_child_props[CHILD_PROP_NEEDS_ATTENTION] =
g_param_spec_boolean ("needs-attention",
P_("Needs Attention"),
P_("Whether this page needs attention"),
FALSE,
GTK_PARAM_READWRITE);
g_object_class_install_properties (object_class, LAST_CHILD_PROP, stack_child_props);
}
static void gtk_stack_add (GtkContainer *widget,
GtkWidget *child);
static void gtk_stack_remove (GtkContainer *widget,
@ -190,19 +431,31 @@ static void gtk_stack_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gtk_stack_get_child_property (GtkContainer *container,
GtkWidget *child,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gtk_stack_set_child_property (GtkContainer *container,
GtkWidget *child,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gtk_stack_unschedule_ticks (GtkStack *stack);
G_DEFINE_TYPE_WITH_PRIVATE (GtkStack, gtk_stack, GTK_TYPE_CONTAINER)
static void gtk_stack_add_page (GtkStack *stack,
GtkStackPage *page);
static void
gtk_stack_buildable_add_child (GtkBuildable *buildable,
GtkBuilder *builder,
GObject *child,
const char *type)
{
if (GTK_IS_STACK_PAGE (child))
gtk_stack_add_page (GTK_STACK (buildable), GTK_STACK_PAGE (child));
else if (GTK_IS_WIDGET (child))
gtk_container_add (GTK_CONTAINER (buildable), GTK_WIDGET (child));
else
g_warning ("Can't add a child of type '%s' to '%s'", G_OBJECT_TYPE_NAME (child), G_OBJECT_TYPE_NAME (buildable));
}
static void
gtk_stack_buildable_interface_init (GtkBuildableIface *iface)
{
iface->add_child = gtk_stack_buildable_add_child;
}
static void
gtk_stack_finalize (GObject *obj)
@ -319,8 +572,6 @@ gtk_stack_class_init (GtkStackClass *klass)
container_class->add = gtk_stack_add;
container_class->remove = gtk_stack_remove;
container_class->forall = gtk_stack_forall;
container_class->set_child_property = gtk_stack_set_child_property;
container_class->get_child_property = gtk_stack_get_child_property;
stack_props[PROP_HOMOGENEOUS] =
g_param_spec_boolean ("homogeneous", P_("Homogeneous"), P_("Homogeneous sizing"),
@ -374,51 +625,6 @@ gtk_stack_class_init (GtkStackClass *klass)
g_object_class_install_properties (object_class, LAST_PROP, stack_props);
stack_child_props[CHILD_PROP_NAME] =
g_param_spec_string ("name",
P_("Name"),
P_("The name of the child page"),
NULL,
GTK_PARAM_READWRITE);
stack_child_props[CHILD_PROP_TITLE] =
g_param_spec_string ("title",
P_("Title"),
P_("The title of the child page"),
NULL,
GTK_PARAM_READWRITE);
stack_child_props[CHILD_PROP_ICON_NAME] =
g_param_spec_string ("icon-name",
P_("Icon name"),
P_("The icon name of the child page"),
NULL,
GTK_PARAM_READWRITE);
stack_child_props[CHILD_PROP_POSITION] =
g_param_spec_int ("position",
P_("Position"),
P_("The index of the child in the parent"),
-1, G_MAXINT,
0,
GTK_PARAM_READWRITE);
/**
* GtkStack:needs-attention:
*
* Sets a flag specifying whether the child requires the user attention.
* This is used by the #GtkStackSwitcher to change the appearance of the
* corresponding button when a page needs attention and it is not the
* current one.
*/
stack_child_props[CHILD_PROP_NEEDS_ATTENTION] =
g_param_spec_boolean ("needs-attention",
P_("Needs Attention"),
P_("Whether this page needs attention"),
FALSE,
GTK_PARAM_READWRITE);
gtk_container_class_install_child_properties (container_class, LAST_CHILD_PROP, stack_child_props);
gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_STACK_ACCESSIBLE);
gtk_widget_class_set_css_name (widget_class, I_("stack"));
@ -437,12 +643,12 @@ gtk_stack_new (void)
return g_object_new (GTK_TYPE_STACK, NULL);
}
static GtkStackChildInfo *
static GtkStackPage *
find_child_info_for_widget (GtkStack *stack,
GtkWidget *child)
{
GtkStackPrivate *priv = gtk_stack_get_instance_private (stack);
GtkStackChildInfo *info;
GtkStackPage *info;
GList *l;
for (l = priv->children; l != NULL; l = l->next)
@ -464,7 +670,7 @@ reorder_child (GtkStack *stack,
GList *l;
GList *old_link = NULL;
GList *new_link = NULL;
GtkStackChildInfo *child_info = NULL;
GtkStackPage *child_info = NULL;
gint num = 0;
l = priv->children;
@ -481,7 +687,7 @@ reorder_child (GtkStack *stack,
if (old_link == NULL)
{
GtkStackChildInfo *info;
GtkStackPage *info;
info = l->data;
/* Keep trying to find the current position and link location of the child */
@ -507,126 +713,6 @@ reorder_child (GtkStack *stack,
gtk_container_child_notify_by_pspec (GTK_CONTAINER (stack), child, stack_child_props[CHILD_PROP_POSITION]);
}
static void
gtk_stack_get_child_property (GtkContainer *container,
GtkWidget *child,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
GtkStack *stack = GTK_STACK (container);
GtkStackPrivate *priv = gtk_stack_get_instance_private (stack);
GtkStackChildInfo *info;
info = find_child_info_for_widget (stack, child);
if (info == NULL)
{
GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
return;
}
switch (property_id)
{
case CHILD_PROP_NAME:
g_value_set_string (value, info->name);
break;
case CHILD_PROP_TITLE:
g_value_set_string (value, info->title);
break;
case CHILD_PROP_ICON_NAME:
g_value_set_string (value, info->icon_name);
break;
case CHILD_PROP_POSITION:
g_value_set_int (value, g_list_index (priv->children, info));
break;
case CHILD_PROP_NEEDS_ATTENTION:
g_value_set_boolean (value, info->needs_attention);
break;
default:
GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
break;
}
}
static void
gtk_stack_set_child_property (GtkContainer *container,
GtkWidget *child,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
GtkStack *stack = GTK_STACK (container);
GtkStackPrivate *priv = gtk_stack_get_instance_private (stack);
GtkStackChildInfo *info;
GtkStackChildInfo *info2;
gchar *name;
GList *l;
info = find_child_info_for_widget (stack, child);
if (info == NULL)
{
GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
return;
}
switch (property_id)
{
case CHILD_PROP_NAME:
name = g_value_dup_string (value);
for (l = priv->children; l != NULL; l = l->next)
{
info2 = l->data;
if (info == info2)
continue;
if (g_strcmp0 (info2->name, name) == 0)
{
g_warning ("Duplicate child name in GtkStack: %s", name);
break;
}
}
g_free (info->name);
info->name = name;
gtk_container_child_notify_by_pspec (container, child, pspec);
if (priv->visible_child == info)
g_object_notify_by_pspec (G_OBJECT (stack),
stack_props[PROP_VISIBLE_CHILD_NAME]);
break;
case CHILD_PROP_TITLE:
g_free (info->title);
info->title = g_value_dup_string (value);
gtk_container_child_notify_by_pspec (container, child, pspec);
break;
case CHILD_PROP_ICON_NAME:
g_free (info->icon_name);
info->icon_name = g_value_dup_string (value);
gtk_container_child_notify_by_pspec (container, child, pspec);
break;
case CHILD_PROP_POSITION:
reorder_child (stack, child, g_value_get_int (value));
break;
case CHILD_PROP_NEEDS_ATTENTION:
info->needs_attention = g_value_get_boolean (value);
gtk_container_child_notify_by_pspec (container, child, pspec);
break;
default:
GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
break;
}
}
static inline gboolean
is_left_transition (GtkStackTransitionType transition_type)
@ -922,12 +1008,12 @@ gtk_stack_start_transition (GtkStack *stack,
static void
set_visible_child (GtkStack *stack,
GtkStackChildInfo *child_info,
GtkStackPage *child_info,
GtkStackTransitionType transition_type,
guint transition_duration)
{
GtkStackPrivate *priv = gtk_stack_get_instance_private (stack);
GtkStackChildInfo *info;
GtkStackPage *info;
GtkWidget *widget = GTK_WIDGET (stack);
GList *l;
GtkWidget *toplevel;
@ -1061,7 +1147,7 @@ stack_child_visibility_notify_cb (GObject *obj,
GtkStack *stack = GTK_STACK (user_data);
GtkStackPrivate *priv = gtk_stack_get_instance_private (stack);
GtkWidget *child = GTK_WIDGET (obj);
GtkStackChildInfo *child_info;
GtkStackPage *child_info;
child_info = find_child_info_for_widget (stack, child);
@ -1079,6 +1165,12 @@ stack_child_visibility_notify_cb (GObject *obj,
}
}
static void
gtk_stack_add_internal (GtkStack *stack,
GtkWidget *child,
const char *name,
const char *title);
/**
* gtk_stack_add_titled:
* @stack: a #GtkStack
@ -1100,11 +1192,7 @@ gtk_stack_add_titled (GtkStack *stack,
g_return_if_fail (GTK_IS_STACK (stack));
g_return_if_fail (GTK_IS_WIDGET (child));
gtk_container_add_with_properties (GTK_CONTAINER (stack),
child,
"name", name,
"title", title,
NULL);
gtk_stack_add_internal (stack, child, name, title);
}
/**
@ -1124,10 +1212,7 @@ gtk_stack_add_named (GtkStack *stack,
g_return_if_fail (GTK_IS_STACK (stack));
g_return_if_fail (GTK_IS_WIDGET (child));
gtk_container_add_with_properties (GTK_CONTAINER (stack),
child,
"name", name,
NULL);
gtk_stack_add_internal (stack, child, name, NULL);
}
static void
@ -1135,31 +1220,65 @@ gtk_stack_add (GtkContainer *container,
GtkWidget *child)
{
GtkStack *stack = GTK_STACK (container);
GtkStackPrivate *priv = gtk_stack_get_instance_private (stack);
GtkStackChildInfo *child_info;
gtk_stack_add_internal (stack, child, NULL, NULL);
}
static void
gtk_stack_add_internal (GtkStack *stack,
GtkWidget *child,
const char *name,
const char *title)
{
GtkStackPage *child_info;
g_return_if_fail (child != NULL);
child_info = g_slice_new (GtkStackChildInfo);
child_info->widget = child;
child_info->name = NULL;
child_info->title = NULL;
child_info = g_object_new (GTK_TYPE_STACK_PAGE, NULL);
child_info->widget = g_object_ref (child);
child_info->name = g_strdup (name);
child_info->title = g_strdup (title);
child_info->icon_name = NULL;
child_info->needs_attention = FALSE;
child_info->last_focus = NULL;
priv->children = g_list_append (priv->children, child_info);
gtk_stack_add_page (stack, child_info);
gtk_widget_set_child_visible (child, FALSE);
gtk_widget_set_parent (child, GTK_WIDGET (stack));
g_object_unref (child_info);
}
g_signal_connect (child, "notify::visible",
static void
gtk_stack_add_page (GtkStack *stack,
GtkStackPage *child_info)
{
GtkStackPrivate *priv = gtk_stack_get_instance_private (stack);
GList *l;
g_return_if_fail (child_info->widget != NULL);
for (l = priv->children; l != NULL; l = l->next)
{
GtkStackPage *info = l->data;
if (info->name &&
g_strcmp0 (info->name, child_info->name) == 0)
{
g_warning ("While adding page: duplicate child name in GtkStack: %s", child_info->name);
break;
}
}
priv->children = g_list_append (priv->children, g_object_ref (child_info));
gtk_widget_set_child_visible (child_info->widget, FALSE);
gtk_widget_set_parent (child_info->widget, GTK_WIDGET (stack));
g_signal_connect (child_info->widget, "notify::visible",
G_CALLBACK (stack_child_visibility_notify_cb), stack);
gtk_container_child_notify_by_pspec (container, child, stack_child_props[CHILD_PROP_POSITION]);
g_object_notify_by_pspec (G_OBJECT (child_info), stack_child_props[CHILD_PROP_POSITION]);
if (priv->visible_child == NULL &&
gtk_widget_get_visible (child))
gtk_widget_get_visible (child_info->widget))
set_visible_child (stack, child_info, priv->transition_type, priv->transition_duration);
if (priv->hhomogeneous || priv->vhomogeneous || priv->visible_child == child_info)
@ -1172,7 +1291,7 @@ gtk_stack_remove (GtkContainer *container,
{
GtkStack *stack = GTK_STACK (container);
GtkStackPrivate *priv = gtk_stack_get_instance_private (stack);
GtkStackChildInfo *child_info;
GtkStackPage *child_info;
gboolean was_visible;
child_info = find_child_info_for_widget (stack, child);
@ -1197,20 +1316,28 @@ gtk_stack_remove (GtkContainer *container,
gtk_widget_unparent (child);
g_free (child_info->name);
g_free (child_info->title);
g_free (child_info->icon_name);
if (child_info->last_focus)
g_object_remove_weak_pointer (G_OBJECT (child_info->last_focus),
(gpointer *)&child_info->last_focus);
g_slice_free (GtkStackChildInfo, child_info);
g_object_unref (child_info);
if ((priv->hhomogeneous || priv->vhomogeneous) && was_visible)
gtk_widget_queue_resize (GTK_WIDGET (stack));
}
/**
* gtk_stack_get_page:
* @stack: a #GtkStack
* @child: a child of @stack
*
* Returns the #GtkStackPage object for @child.
*
* Returns: (transfer none): the #GtkStackPage for @child
*/
GtkStackPage *
gtk_stack_get_page (GtkStack *stack,
GtkWidget *child)
{
return find_child_info_for_widget (stack, child);
}
/**
* gtk_stack_get_child_by_name:
* @stack: a #GtkStack
@ -1227,7 +1354,7 @@ gtk_stack_get_child_by_name (GtkStack *stack,
const gchar *name)
{
GtkStackPrivate *priv = gtk_stack_get_instance_private (stack);
GtkStackChildInfo *info;
GtkStackPage *info;
GList *l;
g_return_val_if_fail (GTK_IS_STACK (stack), NULL);
@ -1243,6 +1370,20 @@ gtk_stack_get_child_by_name (GtkStack *stack,
return NULL;
}
/**
* gtk_stack_page_get_child:
* @page: a #GtkStackPage
*
* Returns the stack child to which @page belongs.
*
* Returns: (transfer none): the child to which @page belongs
*/
GtkWidget *
gtk_stack_page_get_child (GtkStackPage *page)
{
return page->widget;
}
/**
* gtk_stack_set_homogeneous:
* @stack: a #GtkStack
@ -1630,7 +1771,7 @@ gtk_stack_set_visible_child (GtkStack *stack,
GtkWidget *child)
{
GtkStackPrivate *priv = gtk_stack_get_instance_private (stack);
GtkStackChildInfo *child_info;
GtkStackPage *child_info;
g_return_if_fail (GTK_IS_STACK (stack));
g_return_if_fail (GTK_IS_WIDGET (child));
@ -1694,7 +1835,7 @@ gtk_stack_set_visible_child_full (GtkStack *stack,
GtkStackTransitionType transition)
{
GtkStackPrivate *priv = gtk_stack_get_instance_private (stack);
GtkStackChildInfo *child_info, *info;
GtkStackPage *child_info, *info;
GList *l;
g_return_if_fail (GTK_IS_STACK (stack));
@ -1731,7 +1872,7 @@ gtk_stack_forall (GtkContainer *container,
{
GtkStack *stack = GTK_STACK (container);
GtkStackPrivate *priv = gtk_stack_get_instance_private (stack);
GtkStackChildInfo *child_info;
GtkStackPage *child_info;
GList *l;
l = priv->children;
@ -1753,7 +1894,7 @@ gtk_stack_compute_expand (GtkWidget *widget,
GtkStack *stack = GTK_STACK (widget);
GtkStackPrivate *priv = gtk_stack_get_instance_private (stack);
gboolean hexpand, vexpand;
GtkStackChildInfo *child_info;
GtkStackPage *child_info;
GtkWidget *child;
GList *l;
@ -2088,7 +2229,7 @@ gtk_stack_measure (GtkWidget *widget,
{
GtkStack *stack = GTK_STACK (widget);
GtkStackPrivate *priv = gtk_stack_get_instance_private (stack);
GtkStackChildInfo *child_info;
GtkStackPage *child_info;
GtkWidget *child;
gint child_min, child_nat;
GList *l;

View File

@ -41,6 +41,16 @@ G_BEGIN_DECLS
typedef struct _GtkStack GtkStack;
typedef struct _GtkStackClass GtkStackClass;
#define GTK_TYPE_STACK_PAGE (gtk_stack_page_get_type ())
#define GTK_STACK_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_STACK_PAGE, GtkStackPage))
#define GTK_STACK_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_STACK_PAGE, GtkStackPageClass))
#define GTK_IS_STACK_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_STACK_PAGE))
#define GTK_IS_STACK_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_STACK_PAGE))
#define GTK_STACK_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_STACK_PAGE, GtkStackPageClass))
typedef struct _GtkStackPage GtkStackPage;
typedef struct _GtkStackPageClass GtkStackPageClass;
typedef enum {
GTK_STACK_TRANSITION_TYPE_NONE,
GTK_STACK_TRANSITION_TYPE_CROSSFADE,
@ -72,6 +82,9 @@ struct _GtkStackClass {
GtkContainerClass parent_class;
};
GDK_AVAILABLE_IN_ALL
GType gtk_stack_page_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GType gtk_stack_get_type (void) G_GNUC_CONST;
@ -86,6 +99,13 @@ void gtk_stack_add_titled (GtkStack
GtkWidget *child,
const gchar *name,
const gchar *title);
GDK_AVAILABLE_IN_ALL
GtkStackPage * gtk_stack_get_page (GtkStack *stack,
GtkWidget *child);
GDK_AVAILABLE_IN_ALL
GtkWidget * gtk_stack_page_get_child (GtkStackPage *page);
GDK_AVAILABLE_IN_ALL
GtkWidget * gtk_stack_get_child_by_name (GtkStack *stack,
const gchar *name);

View File

@ -140,7 +140,7 @@ sort_list (GtkListBoxRow *row1,
{
item = gtk_bin_get_child (GTK_BIN (row1));
widget = g_object_get_data (G_OBJECT (item), "stack-child");
gtk_container_child_get (GTK_CONTAINER (priv->stack), widget,
g_object_get (gtk_stack_get_page (GTK_STACK (priv->stack), widget),
"position", &left,
NULL);
}
@ -149,7 +149,7 @@ sort_list (GtkListBoxRow *row1,
{
item = gtk_bin_get_child (GTK_BIN (row2));
widget = g_object_get_data (G_OBJECT (item), "stack-child");
gtk_container_child_get (GTK_CONTAINER (priv->stack), widget,
g_object_get (gtk_stack_get_page (GTK_STACK (priv->stack), widget),
"position", &right,
NULL);
}
@ -227,10 +227,10 @@ update_row (GtkStackSidebar *sidebar,
gboolean needs_attention;
GtkStyleContext *context;
gtk_container_child_get (GTK_CONTAINER (priv->stack), widget,
"title", &title,
"needs-attention", &needs_attention,
NULL);
g_object_get (gtk_stack_get_page (GTK_STACK (priv->stack), widget),
"title", &title,
"needs-attention", &needs_attention,
NULL);
item = gtk_bin_get_child (GTK_BIN (row));
gtk_label_set_text (GTK_LABEL (item), title);
@ -275,6 +275,7 @@ add_child (GtkWidget *widget,
GtkStackSidebarPrivate *priv = gtk_stack_sidebar_get_instance_private (sidebar);
GtkWidget *item;
GtkWidget *row;
GObject *page;
/* Check we don't actually already know about this widget */
if (g_hash_table_lookup (priv->rows, widget))
@ -291,13 +292,14 @@ add_child (GtkWidget *widget,
update_row (sidebar, widget, row);
/* Hook up for events */
g_signal_connect (widget, "child-notify::title",
G_CALLBACK (on_child_updated), sidebar);
g_signal_connect (widget, "child-notify::needs-attention",
G_CALLBACK (on_child_updated), sidebar);
page = gtk_stack_get_page (GTK_STACK (priv->stack), widget);
g_signal_connect (widget, "notify::visible",
G_CALLBACK (on_child_updated), sidebar);
g_signal_connect (widget, "child-notify::position",
g_signal_connect (page, "notify::title",
G_CALLBACK (on_child_updated), sidebar);
g_signal_connect (page, "notify::needs-attention",
G_CALLBACK (on_child_updated), sidebar);
g_signal_connect (page, "notify::position",
G_CALLBACK (on_position_updated), sidebar);
g_object_set_data (G_OBJECT (item), I_("stack-child"), widget);
@ -316,8 +318,15 @@ remove_child (GtkWidget *widget,
if (!row)
return;
g_signal_handlers_disconnect_by_func (widget, on_child_updated, sidebar);
g_signal_handlers_disconnect_by_func (widget, on_position_updated, sidebar);
if (priv->stack)
{
GObject *page = gtk_stack_get_page (GTK_STACK (priv->stack), widget);
if (page)
{
g_signal_handlers_disconnect_by_func (page, on_child_updated, sidebar);
g_signal_handlers_disconnect_by_func (page, on_position_updated, sidebar);
}
}
gtk_container_remove (GTK_CONTAINER (priv->list), row);
g_hash_table_remove (priv->rows, widget);

View File

@ -159,25 +159,6 @@ rebuild_child (GtkWidget *self,
}
}
static void
update_needs_attention (GtkWidget *widget, GtkWidget *button, gpointer data)
{
GtkContainer *container;
gboolean needs_attention;
GtkStyleContext *context;
container = GTK_CONTAINER (data);
gtk_container_child_get (container, widget,
"needs-attention", &needs_attention,
NULL);
context = gtk_widget_get_style_context (button);
if (needs_attention)
gtk_style_context_add_class (context, GTK_STYLE_CLASS_NEEDS_ATTENTION);
else
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_NEEDS_ATTENTION);
}
static void
update_button (GtkStackSwitcher *self,
GtkWidget *widget,
@ -185,29 +166,35 @@ update_button (GtkStackSwitcher *self,
{
gchar *title;
gchar *icon_name;
gboolean needs_attention;
GtkStackSwitcherPrivate *priv;
GtkStyleContext *context;
priv = gtk_stack_switcher_get_instance_private (self);
gtk_container_child_get (GTK_CONTAINER (priv->stack), widget,
"title", &title,
"icon-name", &icon_name,
NULL);
g_object_get (gtk_stack_get_page (priv->stack, widget),
"title", &title,
"icon-name", &icon_name,
"needs-attention", &needs_attention,
NULL);
rebuild_child (button, icon_name, title);
gtk_widget_set_visible (button, gtk_widget_get_visible (widget) && (title != NULL || icon_name != NULL));
context = gtk_widget_get_style_context (button);
if (needs_attention)
gtk_style_context_add_class (context, GTK_STYLE_CLASS_NEEDS_ATTENTION);
else
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_NEEDS_ATTENTION);
g_free (title);
g_free (icon_name);
update_needs_attention (widget, button, priv->stack);
}
static void
on_title_icon_visible_updated (GtkWidget *widget,
GParamSpec *pspec,
GtkStackSwitcher *self)
on_visible_updated (GtkWidget *widget,
GParamSpec *pspec,
GtkStackSwitcher *self)
{
GtkWidget *button;
GtkStackSwitcherPrivate *priv;
@ -219,16 +206,34 @@ on_title_icon_visible_updated (GtkWidget *widget,
}
static void
on_position_updated (GtkWidget *widget,
on_title_icon_updated (GtkStackPage *page,
GParamSpec *pspec,
GtkStackSwitcher *self)
{
GtkWidget *widget;
GtkWidget *button;
GtkStackSwitcherPrivate *priv;
priv = gtk_stack_switcher_get_instance_private (self);
widget = gtk_stack_page_get_child (page);
button = g_hash_table_lookup (priv->buttons, widget);
update_button (self, widget, button);
}
static void
on_position_updated (GtkStackPage *page,
GParamSpec *pspec,
GtkStackSwitcher *self)
{
GtkWidget *widget;
GtkWidget *button;
gint position;
GtkStackSwitcherPrivate *priv;
priv = gtk_stack_switcher_get_instance_private (self);
widget = gtk_stack_page_get_child (page);
button = g_hash_table_lookup (priv->buttons, widget);
gtk_container_child_get (GTK_CONTAINER (priv->stack), widget,
@ -248,15 +253,17 @@ on_position_updated (GtkWidget *widget,
}
static void
on_needs_attention_updated (GtkWidget *widget,
on_needs_attention_updated (GtkStackPage *page,
GParamSpec *pspec,
GtkStackSwitcher *self)
{
GtkWidget *widget;
GtkWidget *button;
GtkStackSwitcherPrivate *priv;
priv = gtk_stack_switcher_get_instance_private (self);
widget = gtk_stack_page_get_child (page);
button = g_hash_table_lookup (priv->buttons, widget);
update_button (self, widget, button);
}
@ -354,6 +361,7 @@ add_child (GtkWidget *widget,
GtkWidget *button;
GList *group;
GtkStackSwitcherPrivate *priv;
GtkStackPage *page;
priv = gtk_stack_switcher_get_instance_private (self);
@ -362,6 +370,7 @@ add_child (GtkWidget *widget,
gtk_widget_set_focus_on_click (button, FALSE);
gtk_check_button_set_draw_indicator (GTK_CHECK_BUTTON (button), FALSE);
page = gtk_stack_get_page (GTK_STACK (priv->stack), widget);
update_button (self, widget, button);
group = gtk_container_get_children (GTK_CONTAINER (self));
@ -375,11 +384,11 @@ add_child (GtkWidget *widget,
g_object_set_data (G_OBJECT (button), "stack-child", widget);
g_signal_connect (button, "clicked", G_CALLBACK (on_button_clicked), self);
g_signal_connect (widget, "notify::visible", G_CALLBACK (on_title_icon_visible_updated), self);
g_signal_connect (widget, "child-notify::title", G_CALLBACK (on_title_icon_visible_updated), self);
g_signal_connect (widget, "child-notify::icon-name", G_CALLBACK (on_title_icon_visible_updated), self);
g_signal_connect (widget, "child-notify::position", G_CALLBACK (on_position_updated), self);
g_signal_connect (widget, "child-notify::needs-attention", G_CALLBACK (on_needs_attention_updated), self);
g_signal_connect (widget, "notify::visible", G_CALLBACK (on_visible_updated), self);
g_signal_connect (page, "notify::title", G_CALLBACK (on_title_icon_updated), self);
g_signal_connect (page, "notify::icon-name", G_CALLBACK (on_title_icon_updated), self);
g_signal_connect (page, "notify::position", G_CALLBACK (on_position_updated), self);
g_signal_connect (page, "notify::needs-attention", G_CALLBACK (on_needs_attention_updated), self);
g_hash_table_insert (priv->buttons, widget, button);
}
@ -393,10 +402,17 @@ remove_child (GtkWidget *widget,
priv = gtk_stack_switcher_get_instance_private (self);
g_signal_handlers_disconnect_by_func (widget, on_title_icon_visible_updated, self);
g_signal_handlers_disconnect_by_func (widget, on_position_updated, self);
g_signal_handlers_disconnect_by_func (widget, on_needs_attention_updated, self);
if (priv->stack)
{
GtkStackPage *page = gtk_stack_get_page (priv->stack, widget);
if (page)
{
g_signal_handlers_disconnect_by_func (page, on_title_icon_updated, self);
g_signal_handlers_disconnect_by_func (page, on_position_updated, self);
g_signal_handlers_disconnect_by_func (page, on_needs_attention_updated, self);
}
g_signal_handlers_disconnect_by_func (widget, on_visible_updated, self);
}
button = g_hash_table_lookup (priv->buttons, widget);
gtk_container_remove (GTK_CONTAINER (self), button);
g_hash_table_remove (priv->buttons, widget);

View File

@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="gtk40">
<object class="GtkListStore" id="model">
<columns>

View File

@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="gtk40">
<object class="GtkTextTagTable" id="tags">
<child type="tag">

View File

@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="gtk40">
<object class="GtkListStore" id="prop_model">
<columns>

View File

@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="gtk40">
<template class="GtkInspectorDataList" parent="GtkBox">
<property name="orientation">vertical</property>
@ -27,8 +26,7 @@
<property name="expand">1</property>
<property name="vscrollbar-policy">always</property>
<child>
<object class="GtkTreeView" id="view">
</object>
<object class="GtkTreeView" id="view"/>
</child>
</object>
</child>

View File

@ -1,9 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="gtk40">
<template class="GtkInspectorGeneral" parent="GtkScrolledWindow">
<property name="hscrollbar-policy">never</property>
<property name="vscrollbar-policy">automatic</property>
<property name="expand">0</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>

View File

@ -81,10 +81,10 @@ add_child (GtkWidget *widget,
{
char *name, *title;
gtk_container_child_get (GTK_CONTAINER (self->stack), widget,
"name", &name,
"title", &title,
NULL);
g_object_get (gtk_stack_get_page (self->stack, widget),
"name", &name,
"title", &title,
NULL);
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (self->combo), name, title);

View File

@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="gtk40">
<template class="GtkInspectorLogs" parent="GtkBox">
<child>
@ -17,7 +16,7 @@
<property name="margin-bottom">10</property>
<property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
<attribute name="weight" value="bold"></attribute>
</attributes>
</object>
</child>
@ -98,7 +97,7 @@
<property name="margin-bottom">10</property>
<property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
<attribute name="weight" value="bold"></attribute>
</attributes>
</object>
</child>
@ -161,7 +160,7 @@
<property name="margin-bottom">10</property>
<property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
<attribute name="weight" value="bold"></attribute>
</attributes>
</object>
</child>

View File

@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="gtk40">
<template class="GtkInspectorMagnifier" parent="GtkBox">
<property name="orientation">vertical</property>

View File

@ -1,17 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="gtk40">
<object class="GtkTreeStore" id="model">
<columns>
<column type="gchararray"/>
<!-- type -->
<column type="gchararray"/>
<!-- label -->
<column type="gchararray"/>
<!-- action -->
<column type="gchararray"/>
<!-- target -->
<column type="gchararray"/>
<!-- icon -->
</columns>
</object>
<template class="GtkInspectorMenu" parent="GtkBox">

View File

@ -1,7 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="gtk40">
<template class="GtkInspectorMiscInfo" parent="GtkScrolledWindow">
<property name="expand">0</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>

View File

@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="gtk40">
<object class="GtkTreeStore" id="model">
<columns>

View File

@ -1,7 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="gtk40">
<template class="GtkInspectorObjectTree" parent="GtkBox">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<signal name="hierarchy-changed" handler="on_hierarchy_changed"/>
<child>

View File

@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="gtk40">
<object class="GtkListStore" id="model">
<columns>

View File

@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="gtk40">
<object class="GListStore" id="recordings"/>
<template class="GtkInspectorRecorder" parent="GtkBin">
@ -145,7 +144,7 @@
</child>
<child>
<object class="GtkPicture" id="render_node_view">
<property name="expand">True</property>
<property name="expand">1</property>
</object>
</child>
</object>

View File

@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="gtk40">
<object class="GtkTreeStore" id="model">
<columns>
@ -8,231 +7,237 @@
<column type="guint64"/>
</columns>
</object>
<object class="GtkTextBuffer" id="buffer">
</object>
<object class="GtkTextBuffer" id="buffer"/>
<template class="GtkInspectorResourceList" parent="GtkBox">
<property name="orientation">horizontal</property>
<signal name="hierarchy-changed" handler="on_hierarchy_changed"/>
<child>
<object class="GtkStack" id="stack">
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkSearchBar" id="search_bar">
<property name="show-close-button">1</property>
<child>
<object class="GtkBox">
<style>
<class name="linked"/>
</style>
<child>
<object class="GtkSearchEntry" id="search_entry">
<property name="max-width-chars">40</property>
<signal name="search-changed" handler="on_search_changed"/>
</object>
</child>
<child>
<object class="GtkButton">
<property name="icon-name">go-down-symbolic</property>
<signal name="clicked" handler="next_match"/>
</object>
</child>
<child>
<object class="GtkButton">
<property name="icon-name">go-up-symbolic</property>
<signal name="clicked" handler="previous_match"/>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="expand">1</property>
<property name="hscrollbar-policy">never</property>
<child>
<object class="GtkTreeView" id="tree">
<property name="model">model</property>
<property name="enable-search">0</property>
<property name="enable-grid-lines">vertical</property>
<signal name="row-activated" handler="row_activated"/>
<child internal-child="selection">
<object class="GtkTreeSelection">
<signal name="changed" handler="on_selection_changed"/>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="path_column">
<property name="title" translatable="yes">Path</property>
<property name="resizable">1</property>
<property name="sort-column-id">0</property>
<child>
<object class="GtkCellRendererText">
<property name="scale">0.8</property>
<property name="ellipsize">end</property>
<property name="width-chars">10</property>
<property name="max-width-chars">5</property>
</object>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="count_column">
<property name="title" translatable="yes">Count</property>
<property name="resizable">1</property>
<property name="sort-column-id">1</property>
<child>
<object class="GtkCellRendererText" id="count_renderer">
<property name="scale">0.8</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="size_column">
<property name="title" translatable="yes">Size</property>
<property name="resizable">1</property>
<property name="sort-column-id">2</property>
<child>
<object class="GtkCellRendererText" id="size_renderer">
<property name="scale">0.8</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<object class="GtkStackPage">
<property name="name">list</property>
</packing>
<property name="child">
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkSearchBar" id="search_bar">
<property name="show-close-button">1</property>
<child>
<object class="GtkBox">
<style>
<class name="linked"/>
</style>
<child>
<object class="GtkSearchEntry" id="search_entry">
<property name="max-width-chars">40</property>
<signal name="search-changed" handler="on_search_changed"/>
</object>
</child>
<child>
<object class="GtkButton">
<property name="icon-name">go-down-symbolic</property>
<signal name="clicked" handler="next_match"/>
</object>
</child>
<child>
<object class="GtkButton">
<property name="icon-name">go-up-symbolic</property>
<signal name="clicked" handler="previous_match"/>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="expand">1</property>
<property name="hscrollbar-policy">never</property>
<child>
<object class="GtkTreeView" id="tree">
<property name="model">model</property>
<property name="enable-search">0</property>
<property name="enable-grid-lines">vertical</property>
<signal name="row-activated" handler="row_activated"/>
<child internal-child="selection">
<object class="GtkTreeSelection">
<signal name="changed" handler="on_selection_changed"/>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="path_column">
<property name="title" translatable="yes">Path</property>
<property name="resizable">1</property>
<property name="sort-column-id">0</property>
<child>
<object class="GtkCellRendererText">
<property name="scale">0.8</property>
<property name="ellipsize">end</property>
<property name="width-chars">10</property>
<property name="max-width-chars">5</property>
</object>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="count_column">
<property name="title" translatable="yes">Count</property>
<property name="resizable">1</property>
<property name="sort-column-id">1</property>
<child>
<object class="GtkCellRendererText" id="count_renderer">
<property name="scale">0.8</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="size_column">
<property name="title" translatable="yes">Size</property>
<property name="resizable">1</property>
<property name="sort-column-id">2</property>
<child>
<object class="GtkCellRendererText" id="size_renderer">
<property name="scale">0.8</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</property>
</object>
</child>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkGrid" id="info_grid">
<property name="row-spacing">10</property>
<property name="column-spacing">10</property>
<property name="margin">10</property>
<property name="halign">center</property>
<child>
<object class="GtkLabel" id="name">
<property name="label" translatable="yes">Name:</property>
<property name="halign">end</property>
<property name="valign">baseline</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="name_label">
<property name="halign">start</property>
<property name="valign">baseline</property>
<property name="selectable">1</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="type">
<property name="label" translatable="yes">Type:</property>
<property name="halign">end</property>
<property name="valign">baseline</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="type_label">
<property name="halign">start</property>
<property name="valign">baseline</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Size:</property>
<property name="halign">end</property>
<property name="valign">baseline</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="size_label">
<property name="halign">start</property>
<property name="valign">baseline</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</packing>
</child>
</object>
</child>
<child>
<object class="GtkStack" id="content">
<child>
<object class="GtkScrolledWindow">
<property name="expand">1</property>
<property name="shadow-type">in</property>
<style>
<class name="view"/>
</style>
<child>
<object class="GtkTextView">
<property name="editable">0</property>
<property name="buffer">buffer</property>
</object>
</child>
</object>
<packing>
<property name="name">text</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="expand">1</property>
<property name="shadow-type">in</property>
<style>
<class name="view"/>
</style>
<child>
<object class="GtkImage" id="image">
<property name="halign">center</property>
<property name="valign">center</property>
</object>
</child>
</object>
<packing>
<property name="name">image</property>
</packing>
</child>
</object>
</child>
</object>
<packing>
<object class="GtkStackPage">
<property name="name">details</property>
</packing>
<property name="child">
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkGrid" id="info_grid">
<property name="row-spacing">10</property>
<property name="column-spacing">10</property>
<property name="margin">10</property>
<property name="halign">center</property>
<child>
<object class="GtkLabel" id="name">
<property name="label" translatable="yes">Name:</property>
<property name="halign">end</property>
<property name="valign">baseline</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="name_label">
<property name="halign">start</property>
<property name="valign">baseline</property>
<property name="selectable">1</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="type">
<property name="label" translatable="yes">Type:</property>
<property name="halign">end</property>
<property name="valign">baseline</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="type_label">
<property name="halign">start</property>
<property name="valign">baseline</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Size:</property>
<property name="halign">end</property>
<property name="valign">baseline</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="size_label">
<property name="halign">start</property>
<property name="valign">baseline</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</packing>
</child>
</object>
</child>
<child>
<object class="GtkStack" id="content">
<child>
<object class="GtkStackPage">
<property name="name">text</property>
<property name="child">
<object class="GtkScrolledWindow">
<property name="expand">1</property>
<property name="shadow-type">in</property>
<style>
<class name="view"/>
</style>
<child>
<object class="GtkTextView">
<property name="editable">0</property>
<property name="buffer">buffer</property>
</object>
</child>
</object>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">image</property>
<property name="child">
<object class="GtkScrolledWindow">
<property name="expand">1</property>
<property name="shadow-type">in</property>
<style>
<class name="view"/>
</style>
<child>
<object class="GtkImage" id="image">
<property name="halign">center</property>
<property name="valign">center</property>
</object>
</child>
</object>
</property>
</object>
</child>
</object>
</child>
</object>
</property>
</object>
</child>
</object>
</child>

View File

@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="gtk40">
<object class="GtkTreeStore" id="model">
<columns>

View File

@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="gtk40">
<object class="GtkListStore" id="model">
<columns>

View File

@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="gtk40">
<object class="GtkListStore" id="model">
<columns>
@ -13,145 +12,148 @@
</columns>
</object>
<template class="GtkInspectorStatistics" parent="GtkBox">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkStack" id="stack">
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkSearchBar" id="search_bar">
<property name="show-close-button">1</property>
<child>
<object class="GtkSearchEntry" id="search_entry">
<property name="max-width-chars">40</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="expand">1</property>
<property name="vscrollbar-policy">always</property>
<child>
<object class="GtkTreeView" id="view">
<property name="model">model</property>
<property name="search-column">1</property>
<child>
<object class="GtkTreeViewColumn">
<property name="sort-column-id">1</property>
<property name="title" translatable="yes">Type</property>
<child>
<object class="GtkCellRendererText">
<property name="scale">0.8</property>
</object>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="column_self1">
<property name="sort-column-id">2</property>
<property name="title" translatable="yes">Self 1</property>
<child>
<object class="GtkCellRendererText" id="renderer_self1">
<property name="scale">0.8</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="column_cumulative1">
<property name="sort-column-id">3</property>
<property name="title" translatable="yes">Cumulative 1</property>
<child>
<object class="GtkCellRendererText" id="renderer_cumulative1">
<property name="scale">0.8</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="column_self2">
<property name="sort-column-id">4</property>
<property name="title" translatable="yes">Self 2</property>
<child>
<object class="GtkCellRendererText" id="renderer_self2">
<property name="scale">0.8</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="column_cumulative2">
<property name="sort-column-id">5</property>
<property name="title" translatable="yes">Cumulative 2</property>
<child>
<object class="GtkCellRendererText" id="renderer_cumulative2">
<property name="scale">0.8</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="column_self_graph">
<property name="sort-column-id">4</property>
<property name="title" translatable="yes">Self</property>
<child>
<object class="GtkCellRendererGraph" id="renderer_self_graph">
<property name="minimum">0</property>
<property name="xpad">1</property>
<property name="ypad">1</property>
</object>
<attributes>
<attribute name="data">6</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="column_cumulative_graph">
<property name="sort-column-id">5</property>
<property name="title" translatable="yes">Cumulative</property>
<child>
<object class="GtkCellRendererGraph" id="renderer_cumulative_graph">
<property name="minimum">0</property>
<property name="xpad">1</property>
<property name="ypad">1</property>
</object>
<attributes>
<attribute name="data">7</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<object class="GtkStackPage">
<property name="name">statistics</property>
</packing>
<property name="child">
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkSearchBar" id="search_bar">
<property name="show-close-button">1</property>
<child>
<object class="GtkSearchEntry" id="search_entry">
<property name="max-width-chars">40</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="expand">1</property>
<property name="vscrollbar-policy">always</property>
<child>
<object class="GtkTreeView" id="view">
<property name="model">model</property>
<property name="search-column">1</property>
<child>
<object class="GtkTreeViewColumn">
<property name="sort-column-id">1</property>
<property name="title" translatable="yes">Type</property>
<child>
<object class="GtkCellRendererText">
<property name="scale">0.8</property>
</object>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="column_self1">
<property name="sort-column-id">2</property>
<property name="title" translatable="yes">Self 1</property>
<child>
<object class="GtkCellRendererText" id="renderer_self1">
<property name="scale">0.8</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="column_cumulative1">
<property name="sort-column-id">3</property>
<property name="title" translatable="yes">Cumulative 1</property>
<child>
<object class="GtkCellRendererText" id="renderer_cumulative1">
<property name="scale">0.8</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="column_self2">
<property name="sort-column-id">4</property>
<property name="title" translatable="yes">Self 2</property>
<child>
<object class="GtkCellRendererText" id="renderer_self2">
<property name="scale">0.8</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="column_cumulative2">
<property name="sort-column-id">5</property>
<property name="title" translatable="yes">Cumulative 2</property>
<child>
<object class="GtkCellRendererText" id="renderer_cumulative2">
<property name="scale">0.8</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="column_self_graph">
<property name="sort-column-id">4</property>
<property name="title" translatable="yes">Self</property>
<child>
<object class="GtkCellRendererGraph" id="renderer_self_graph">
<property name="minimum">0</property>
<property name="xpad">1</property>
<property name="ypad">1</property>
</object>
<attributes>
<attribute name="data">6</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="column_cumulative_graph">
<property name="sort-column-id">5</property>
<property name="title" translatable="yes">Cumulative</property>
<child>
<object class="GtkCellRendererGraph" id="renderer_cumulative_graph">
<property name="minimum">0</property>
<property name="xpad">1</property>
<property name="ypad">1</property>
</object>
<attributes>
<attribute name="data">7</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</property>
</object>
</child>
<child>
<object class="GtkBox">
<property name="can-focus">1</property>
<property name="halign">center</property>
<property name="valign">center</property>
<child>
<object class="GtkLabel" id="excuse">
<property name="selectable">1</property>
<property name="label" translatable="yes">Enable statistics with GOBJECT_DEBUG=instance-count</property>
</object>
</child>
</object>
<packing>
<object class="GtkStackPage">
<property name="name">excuse</property>
</packing>
<property name="child">
<object class="GtkBox">
<property name="can-focus">1</property>
<property name="halign">center</property>
<property name="valign">center</property>
<child>
<object class="GtkLabel" id="excuse">
<property name="selectable">1</property>
<property name="label" translatable="yes">Enable statistics with GOBJECT_DEBUG=instance-count</property>
</object>
</child>
</object>
</property>
</object>
</child>
</object>
</child>

View File

@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="gtk40">
<object class="GtkAdjustment" id="scale_adjustment">
<property name="lower">1</property>
@ -26,8 +25,6 @@
</object>
<template class="GtkInspectorVisual" parent="GtkScrolledWindow">
<property name="hscrollbar-policy">never</property>
<property name="vscrollbar-policy">automatic</property>
<property name="expand">0</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
@ -224,7 +221,7 @@
<property name="draw-value">0</property>
<property name="hexpand">1</property>
<marks>
<mark value="1.0" position="top"></mark>
<mark value="1.0" position="top"/>
</marks>
</object>
</child>
@ -348,7 +345,7 @@
<property name="draw-value">0</property>
<property name="hexpand">1</property>
<marks>
<mark value="0.0" position="top"></mark>
<mark value="0.0" position="top"/>
</marks>
</object>
</child>

View File

@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="gtk40">
<object class="GtkAdjustment" id="magnification_adjustment">
<property name="lower">1.0</property>
@ -17,135 +16,161 @@
<object class="GtkStack" id="button_stack">
<property name="visible-child-name" bind-source="top_stack" bind-property="visible-child-name"/>
<child>
<object class="GtkBox">
<property name="spacing">6</property>
<child>
<object class="GtkButton" id="select_object">
<property name="focus-on-click">0</property>
<property name="tooltip-text" translatable="yes">Select an Object</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="icon-name">find-location-symbolic</property>
<signal name="clicked" handler="gtk_inspector_on_inspect"/>
</object>
</child>
<child>
<object class="GtkStack" id="object_buttons">
<child>
<object class="GtkButton" id="object_details_button">
<property name="focus-on-click">0</property>
<property name="tooltip-text" translatable="yes">Show Details</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="icon-name">dialog-information-symbolic</property>
<signal name="clicked" handler="open_object_details"/>
</object>
<packing>
<property name="name">list</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="focus-on-click">0</property>
<property name="tooltip-text" translatable="yes">Show all Objects</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="icon-name">view-list-symbolic</property>
<signal name="clicked" handler="close_object_details"/>
</object>
<packing>
<property name="name">details</property>
</packing>
</child>
</object>
</child>
</object>
<packing>
<object class="GtkStackPage">
<property name="name">objects</property>
</packing>
</child>
<child>
<object class="GtkStack" id="global_button_stack">
<property name="visible-child-name" bind-source="global_stack" bind-property="visible-child-name"/>
<child>
<object class="GtkBox"/>
<packing>
<property name="name">general</property>
</packing>
</child>
<child>
<object class="GtkBox"/>
<packing>
<property name="name">visual</property>
</packing>
</child>
<child>
<object class="GtkStack" id="resource_buttons">
<property name="halign">start</property>
<property name="valign">center</property>
<property name="child">
<object class="GtkBox">
<property name="spacing">6</property>
<child>
<object class="GtkButton">
<object class="GtkButton" id="select_object">
<property name="focus-on-click">0</property>
<property name="tooltip-text" translatable="yes">Show Details</property>
<property name="tooltip-text" translatable="yes">Select an Object</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="icon-name">dialog-information-symbolic</property>
<property name="icon-name">find-location-symbolic</property>
<signal name="clicked" handler="gtk_inspector_on_inspect"/>
</object>
<packing>
<property name="name">list</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="focus-on-click">0</property>
<property name="tooltip-text" translatable="yes">Show all Resources</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="icon-name">view-list-symbolic</property>
<object class="GtkStack" id="object_buttons">
<child>
<object class="GtkStackPage">
<property name="name">list</property>
<property name="child">
<object class="GtkButton" id="object_details_button">
<property name="focus-on-click">0</property>
<property name="tooltip-text" translatable="yes">Show Details</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="icon-name">dialog-information-symbolic</property>
<signal name="clicked" handler="open_object_details"/>
</object>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">details</property>
<property name="child">
<object class="GtkButton">
<property name="focus-on-click">0</property>
<property name="tooltip-text" translatable="yes">Show all Objects</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="icon-name">view-list-symbolic</property>
<signal name="clicked" handler="close_object_details"/>
</object>
</property>
</object>
</child>
</object>
<packing>
<property name="name">details</property>
</packing>
</child>
</object>
<packing>
<property name="name">resources</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="record_statistics_button">
<property name="focus-on-click">0</property>
<property name="tooltip-text" translatable="yes">Collect Statistics</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="icon-name">media-record-symbolic</property>
</object>
<packing>
<property name="name">statistics</property>
</packing>
</child>
<child>
<object class="GtkBox"/>
<packing>
<property name="name">logs</property>
</packing>
</child>
</property>
</object>
<packing>
</child>
<child>
<object class="GtkStackPage">
<property name="name">global</property>
</packing>
<property name="child">
<object class="GtkStack" id="global_button_stack">
<property name="visible-child-name" bind-source="global_stack" bind-property="visible-child-name"/>
<child>
<object class="GtkStackPage">
<property name="name">general</property>
<property name="child">
<object class="GtkBox"/>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">visual</property>
<property name="child">
<object class="GtkBox"/>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">resources</property>
<property name="child">
<object class="GtkStack" id="resource_buttons">
<property name="halign">start</property>
<property name="valign">center</property>
<child>
<object class="GtkStackPage">
<property name="name">list</property>
<property name="child">
<object class="GtkButton">
<property name="focus-on-click">0</property>
<property name="tooltip-text" translatable="yes">Show Details</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="icon-name">dialog-information-symbolic</property>
</object>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">details</property>
<property name="child">
<object class="GtkButton">
<property name="focus-on-click">0</property>
<property name="tooltip-text" translatable="yes">Show all Resources</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="icon-name">view-list-symbolic</property>
</object>
</property>
</object>
</child>
</object>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">statistics</property>
<property name="child">
<object class="GtkToggleButton" id="record_statistics_button">
<property name="focus-on-click">0</property>
<property name="tooltip-text" translatable="yes">Collect Statistics</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="icon-name">media-record-symbolic</property>
</object>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">logs</property>
<property name="child">
<object class="GtkBox"/>
</property>
</object>
</child>
</object>
</property>
</object>
</child>
<child>
<object class="GtkBox"/>
<packing>
<object class="GtkStackPage">
<property name="name">css</property>
</packing>
<property name="child">
<object class="GtkBox"/>
</property>
</object>
</child>
<child>
<object class="GtkBox"/>
<packing>
<object class="GtkStackPage">
<property name="name">recorder</property>
</packing>
<property name="child">
<object class="GtkBox"/>
</property>
</object>
</child>
</object>
</child>
@ -161,310 +186,370 @@
<child>
<object class="GtkStack" id="top_stack">
<child>
<object class="GtkStack" id="object_stack">
<child>
<object class="GtkInspectorObjectTree" id="object_tree">
<signal name="object-activated" handler="on_object_activated"/>
<signal name="object-selected" handler="on_object_selected"/>
</object>
<packing>
<property name="name">object-tree</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkCenterBox">
<child type="start">
<object class="GtkBox">
<property name="spacing">10</property>
<child>
<object class="GtkStackCombo" id="stackcombo">
<property name="margin">6</property>
<property name="stack">object_details</property>
</object>
</child>
<child>
<object class="GtkStack" id="object_start_stack">
<child>
<object class="GtkBox"/>
<packing>
<property name="name">empty</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="spacing">6</property>
<property name="margin">6</property>
<child>
<object class="GtkToggleButton" id="signals_trace_button">
<property name="relief">none</property>
<property name="tooltip-text" translatable="yes">Trace signal emissions on this object</property>
<property name="icon-name">media-record-symbolic</property>
</object>
</child>
<child>
<object class="GtkButton" id="signals_clear_button">
<property name="relief">none</property>
<property name="tooltip-text" translatable="yes">Clear log</property>
<property name="icon-name">edit-clear-symbolic</property>
</object>
</child>
</object>
<packing>
<property name="name">signals</property>
</packing>
</child>
<child>
<object class="GtkScale">
<property name="width-request">150</property>
<property name="draw-value">0</property>
<property name="adjustment">magnification_adjustment</property>
<marks>
<mark value="1.0" position="bottom"></mark>
<mark value="2.0" position="bottom"></mark>
<mark value="3.0" position="bottom"></mark>
<mark value="4.0" position="bottom"></mark>
<mark value="5.0" position="bottom"></mark>
</marks>
</object>
<packing>
<property name="name">magnifier</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="center">
<object class="GtkStack" id="object_center_stack">
<property name="transition-type">crossfade</property>
<property name="hexpand">1</property>
<property name="halign">center</property>
<child>
<object class="GtkLabel" id="object_title"/>
<packing>
<property name="name">title</property>
</packing>
</child>
<child>
<object class="GtkSearchEntry" id="prop_search_entry">
<property name="margin">6</property>
<property name="max-width-chars">40</property>
</object>
<packing>
<property name="name">prop-search</property>
</packing>
</child>
<child>
<object class="GtkSearchEntry" id="child_prop_search_entry">
<property name="margin">6</property>
<property name="max-width-chars">40</property>
</object>
<packing>
<property name="name">child-prop-search</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkStack" id="object_details">
<signal name="notify::visible-child" handler="object_details_changed"/>
<child>
<object class="GtkInspectorMiscInfo" id="misc_info">
<property name="object-tree">object_tree</property>
</object>
<packing>
<property name="name">misc</property>
<property name="title" translatable="yes">Miscellaneous</property>
</packing>
</child>
<child>
<object class="GtkInspectorPropList" id="prop_list">
<property name="child-properties">False</property>
<property name="object-tree">object_tree</property>
<property name="search-entry">prop_search_entry</property>
</object>
<packing>
<property name="name">properties</property>
<property name="title" translatable="yes">Properties</property>
</packing>
</child>
<child>
<object class="GtkInspectorSignalsList" id="signals_list">
<property name="trace-button">signals_trace_button</property>
<property name="clear-button">signals_clear_button</property>
</object>
<packing>
<property name="name">signals</property>
<property name="title" translatable="yes">Signals</property>
</packing>
</child>
<child>
<object class="GtkInspectorPropList" id="child_prop_list">
<property name="child-properties">True</property>
<property name="object-tree">object_tree</property>
<property name="search-entry">child_prop_search_entry</property>
</object>
<packing>
<property name="name">child-properties</property>
<property name="title" translatable="yes">Child Properties</property>
</packing>
</child>
<child>
<object class="GtkInspectorObjectHierarchy" id="object_hierarchy"/>
<packing>
<property name="name">hierarchy</property>
<property name="title" translatable="yes">Class Hierarchy</property>
</packing>
</child>
<child>
<object class="GtkInspectorSelector" id="selector"/>
<packing>
<property name="name">selector</property>
<property name="title" translatable="yes">CSS Selector</property>
</packing>
</child>
<child>
<object class="GtkInspectorCssNodeTree" id="widget_css_node_tree">
<signal name="notify::node" handler="notify_node"/>
</object>
<packing>
<property name="name">css-nodes</property>
<property name="title" translatable="yes">CSS Nodes</property>
</packing>
</child>
<child>
<object class="GtkInspectorSizeGroups" id="size_groups"/>
<packing>
<property name="name">size-groups</property>
<property name="title" translatable="yes">Size Groups</property>
</packing>
</child>
<child>
<object class="GtkInspectorDataList" id="data_list"/>
<packing>
<property name="name">data</property>
<property name="title" translatable="yes">Data</property>
</packing>
</child>
<child>
<object class="GtkInspectorActions" id="actions"/>
<packing>
<property name="name">actions</property>
<property name="title" translatable="yes">Actions</property>
</packing>
</child>
<child>
<object class="GtkInspectorMenu" id="menu"/>
<packing>
<property name="name">menu</property>
<property name="title" translatable="yes">Menu</property>
</packing>
</child>
<child>
<object class="GtkInspectorControllers" id="controllers">
<property name="object-tree">object_tree</property>
</object>
<packing>
<property name="name">controllers</property>
<property name="title" translatable="yes">Controllers</property>
</packing>
</child>
<child>
<object class="GtkInspectorMagnifier" id="magnifier">
<property name="adjustment">magnification_adjustment</property>
</object>
<packing>
<property name="name">magnifier</property>
<property name="title" translatable="yes">Magnifier</property>
</packing>
</child>
</object>
</child>
</object>
<packing>
<property name="name">object-details</property>
</packing>
</child>
</object>
<packing>
<object class="GtkStackPage">
<property name="name">objects</property>
<property name="title" translatable="yes">Objects</property>
</packing>
<property name="child">
<object class="GtkStack" id="object_stack">
<child>
<object class="GtkStackPage">
<property name="name">object-tree</property>
<property name="child">
<object class="GtkInspectorObjectTree" id="object_tree">
<signal name="object-activated" handler="on_object_activated"/>
<signal name="object-selected" handler="on_object_selected"/>
</object>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">object-details</property>
<property name="child">
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkCenterBox">
<child type="start">
<object class="GtkBox">
<property name="spacing">10</property>
<child>
<object class="GtkStackCombo" id="stackcombo">
<property name="margin">6</property>
<property name="stack">object_details</property>
</object>
</child>
<child>
<object class="GtkStack" id="object_start_stack">
<child>
<object class="GtkStackPage">
<property name="name">empty</property>
<property name="child">
<object class="GtkBox"/>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">signals</property>
<property name="child">
<object class="GtkBox">
<property name="spacing">6</property>
<property name="margin">6</property>
<child>
<object class="GtkToggleButton" id="signals_trace_button">
<property name="relief">none</property>
<property name="tooltip-text" translatable="yes">Trace signal emissions on this object</property>
<property name="icon-name">media-record-symbolic</property>
</object>
</child>
<child>
<object class="GtkButton" id="signals_clear_button">
<property name="relief">none</property>
<property name="tooltip-text" translatable="yes">Clear log</property>
<property name="icon-name">edit-clear-symbolic</property>
</object>
</child>
</object>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">magnifier</property>
<property name="child">
<object class="GtkScale">
<property name="width-request">150</property>
<property name="draw-value">0</property>
<property name="adjustment">magnification_adjustment</property>
<marks>
<mark value="1.0" position="bottom"/>
<mark value="2.0" position="bottom"/>
<mark value="3.0" position="bottom"/>
<mark value="4.0" position="bottom"/>
<mark value="5.0" position="bottom"/>
</marks>
</object>
</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child type="center">
<object class="GtkStack" id="object_center_stack">
<property name="transition-type">crossfade</property>
<property name="hexpand">1</property>
<property name="halign">center</property>
<child>
<object class="GtkStackPage">
<property name="name">title</property>
<property name="child">
<object class="GtkLabel" id="object_title"/>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">prop-search</property>
<property name="child">
<object class="GtkSearchEntry" id="prop_search_entry">
<property name="margin">6</property>
<property name="max-width-chars">40</property>
</object>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">child-prop-search</property>
<property name="child">
<object class="GtkSearchEntry" id="child_prop_search_entry">
<property name="margin">6</property>
<property name="max-width-chars">40</property>
</object>
</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkStack" id="object_details">
<signal name="notify::visible-child" handler="object_details_changed"/>
<child>
<object class="GtkStackPage">
<property name="name">misc</property>
<property name="title" translatable="yes">Miscellaneous</property>
<property name="child">
<object class="GtkInspectorMiscInfo" id="misc_info">
<property name="object-tree">object_tree</property>
</object>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">properties</property>
<property name="title" translatable="yes">Properties</property>
<property name="child">
<object class="GtkInspectorPropList" id="prop_list">
<property name="child-properties">False</property>
<property name="object-tree">object_tree</property>
<property name="search-entry">prop_search_entry</property>
</object>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">signals</property>
<property name="title" translatable="yes">Signals</property>
<property name="child">
<object class="GtkInspectorSignalsList" id="signals_list">
<property name="trace-button">signals_trace_button</property>
<property name="clear-button">signals_clear_button</property>
</object>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">child-properties</property>
<property name="title" translatable="yes">Child Properties</property>
<property name="child">
<object class="GtkInspectorPropList" id="child_prop_list">
<property name="child-properties">True</property>
<property name="object-tree">object_tree</property>
<property name="search-entry">child_prop_search_entry</property>
</object>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">hierarchy</property>
<property name="title" translatable="yes">Class Hierarchy</property>
<property name="child">
<object class="GtkInspectorObjectHierarchy" id="object_hierarchy"/>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">selector</property>
<property name="title" translatable="yes">CSS Selector</property>
<property name="child">
<object class="GtkInspectorSelector" id="selector"/>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">css-nodes</property>
<property name="title" translatable="yes">CSS Nodes</property>
<property name="child">
<object class="GtkInspectorCssNodeTree" id="widget_css_node_tree">
<signal name="notify::node" handler="notify_node"/>
</object>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">size-groups</property>
<property name="title" translatable="yes">Size Groups</property>
<property name="child">
<object class="GtkInspectorSizeGroups" id="size_groups"/>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">data</property>
<property name="title" translatable="yes">Data</property>
<property name="child">
<object class="GtkInspectorDataList" id="data_list"/>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">actions</property>
<property name="title" translatable="yes">Actions</property>
<property name="child">
<object class="GtkInspectorActions" id="actions"/>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">menu</property>
<property name="title" translatable="yes">Menu</property>
<property name="child">
<object class="GtkInspectorMenu" id="menu"/>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">controllers</property>
<property name="title" translatable="yes">Controllers</property>
<property name="child">
<object class="GtkInspectorControllers" id="controllers">
<property name="object-tree">object_tree</property>
</object>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">magnifier</property>
<property name="title" translatable="yes">Magnifier</property>
<property name="child">
<object class="GtkInspectorMagnifier" id="magnifier">
<property name="adjustment">magnification_adjustment</property>
</object>
</property>
</object>
</child>
</object>
</child>
</object>
</property>
</object>
</child>
</object>
</property>
</object>
</child>
<child>
<object class="GtkBox">
<child>
<object class="GtkStackSidebar">
<property name="stack">global_stack</property>
</object>
</child>
<child>
<object class="GtkStack" id="global_stack">
<child>
<object class="GtkInspectorGeneral"/>
<packing>
<property name="name">general</property>
<property name="title" translatable="yes">General</property>
</packing>
</child>
<child>
<object class="GtkInspectorVisual"/>
<packing>
<property name="name">visual</property>
<property name="title" translatable="yes">Visual</property>
</packing>
</child>
<child>
<object class="GtkInspectorResourceList">
<property name="buttons">resource_buttons</property>
</object>
<packing>
<property name="name">resources</property>
<property name="title" translatable="yes">Resources</property>
</packing>
</child>
<child>
<object class="GtkInspectorStatistics">
<property name="button">record_statistics_button</property>
</object>
<packing>
<property name="name">statistics</property>
<property name="title" translatable="yes">Statistics</property>
</packing>
</child>
<child>
<object class="GtkInspectorLogs"/>
<packing>
<property name="name">logs</property>
<property name="title" translatable="yes">Logging</property>
</packing>
</child>
</object>
</child>
</object>
<packing>
<object class="GtkStackPage">
<property name="name">global</property>
<property name="title" translatable="yes">Global</property>
</packing>
<property name="child">
<object class="GtkBox">
<child>
<object class="GtkStackSidebar">
<property name="stack">global_stack</property>
</object>
</child>
<child>
<object class="GtkStack" id="global_stack">
<child>
<object class="GtkStackPage">
<property name="name">general</property>
<property name="title" translatable="yes">General</property>
<property name="child">
<object class="GtkInspectorGeneral"/>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">visual</property>
<property name="title" translatable="yes">Visual</property>
<property name="child">
<object class="GtkInspectorVisual"/>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">resources</property>
<property name="title" translatable="yes">Resources</property>
<property name="child">
<object class="GtkInspectorResourceList">
<property name="buttons">resource_buttons</property>
</object>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">statistics</property>
<property name="title" translatable="yes">Statistics</property>
<property name="child">
<object class="GtkInspectorStatistics">
<property name="button">record_statistics_button</property>
</object>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">logs</property>
<property name="title" translatable="yes">Logging</property>
<property name="child">
<object class="GtkInspectorLogs"/>
</property>
</object>
</child>
</object>
</child>
</object>
</property>
</object>
</child>
<child>
<object class="GtkInspectorCssEditor"/>
<packing>
<object class="GtkStackPage">
<property name="name">css</property>
<property name="title" translatable="yes">CSS</property>
</packing>
<property name="child">
<object class="GtkInspectorCssEditor"/>
</property>
</object>
</child>
<child>
<object class="GtkInspectorRecorder" id="widget_recorder"/>
<packing>
<object class="GtkStackPage">
<property name="name">recorder</property>
<property name="title" translatable="yes">Recorder</property>
</packing>
<property name="child">
<object class="GtkInspectorRecorder" id="widget_recorder"/>
</property>
</object>
</child>
</object>
</child>

View File

@ -0,0 +1,74 @@
/* Copyright 2015 Red Hat, Inc.
*
* GTK+ is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* GLib 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with GTK+; see the file COPYING. If not,
* see <http://www.gnu.org/licenses/>.
*
* Author: Matthias Clasen
*/
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <glib/gi18n.h>
#include <glib/gprintf.h>
#include <glib/gstdio.h>
#include <gtk/gtk.h>
#include "gtkbuilderprivate.h"
static const gchar *
object_get_name (GObject *object)
{
if (GTK_IS_BUILDABLE (object))
return gtk_buildable_get_name (GTK_BUILDABLE (object));
else
return g_object_get_data (object, "gtk-builder-name");
}
void
do_enumerate (int *argc, char ***argv)
{
GtkBuilder *builder;
GError *error = NULL;
gint ret;
GSList *list, *l;
GObject *object;
const gchar *name;
const gchar *filename;
filename = (*argv)[1];
builder = gtk_builder_new ();
ret = gtk_builder_add_from_file (builder, filename, &error);
if (ret == 0)
{
g_printerr ("%s\n", error->message);
exit (1);
}
list = gtk_builder_get_objects (builder);
for (l = list; l; l = l->next)
{
object = l->data;
name = object_get_name (object);
if (g_str_has_prefix (name, "___") && g_str_has_suffix (name, "___"))
continue;
g_printf ("%s (%s)\n", name, g_type_name_from_instance ((GTypeInstance*)object));
}
g_slist_free (list);
g_object_unref (builder);
}

View File

@ -0,0 +1,197 @@
/* Copyright 2015 Red Hat, Inc.
*
* GTK+ is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* GLib 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with GTK+; see the file COPYING. If not,
* see <http://www.gnu.org/licenses/>.
*
* Author: Matthias Clasen
*/
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <glib/gi18n.h>
#include <glib/gprintf.h>
#include <glib/gstdio.h>
#include <gtk/gtk.h>
#include "gtkbuilderprivate.h"
static void
set_window_title (GtkWindow *window,
const char *filename,
const char *id)
{
gchar *name;
gchar *title;
name = g_path_get_basename (filename);
if (id)
title = g_strdup_printf ("%s in %s", id, name);
else
title = g_strdup (name);
gtk_window_set_title (window, title);
g_free (title);
g_free (name);
}
static void
preview_file (const char *filename,
const char *id,
const char *cssfile)
{
GtkBuilder *builder;
GError *error = NULL;
GObject *object;
GtkWidget *window;
if (cssfile)
{
GtkCssProvider *provider;
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_path (provider, cssfile);
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
}
builder = gtk_builder_new ();
if (!gtk_builder_add_from_file (builder, filename, &error))
{
g_printerr ("%s\n", error->message);
exit (1);
}
object = NULL;
if (id)
{
object = gtk_builder_get_object (builder, id);
}
else
{
GSList *objects, *l;
objects = gtk_builder_get_objects (builder);
for (l = objects; l; l = l->next)
{
GObject *obj = l->data;
if (GTK_IS_WINDOW (obj))
{
object = obj;
break;
}
else if (GTK_IS_WIDGET (obj))
{
if (object == NULL)
object = obj;
}
}
g_slist_free (objects);
}
if (object == NULL)
{
if (id)
g_printerr ("No object with ID '%s' found\n", id);
else
g_printerr ("No previewable object found\n");
exit (1);
}
if (!GTK_IS_WIDGET (object))
{
g_printerr ("Objects of type %s can't be previewed\n", G_OBJECT_TYPE_NAME (object));
exit (1);
}
if (GTK_IS_WINDOW (object))
window = GTK_WIDGET (object);
else
{
GtkWidget *widget = GTK_WIDGET (object);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
if (GTK_IS_BUILDABLE (object))
id = gtk_buildable_get_name (GTK_BUILDABLE (object));
set_window_title (GTK_WINDOW (window), filename, id);
g_object_ref (widget);
if (gtk_widget_get_parent (widget) != NULL)
gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (widget)), widget);
gtk_container_add (GTK_CONTAINER (window), widget);
g_object_unref (widget);
}
gtk_window_present (GTK_WINDOW (window));
gtk_main ();
g_object_unref (builder);
}
void
do_preview (int *argc,
const char ***argv)
{
GOptionContext *context;
char *id = NULL;
char *css = NULL;
char **filenames = NULL;
const GOptionEntry entries[] = {
{ "id", 0, 0, G_OPTION_ARG_STRING, &id, NULL, NULL },
{ "css", 0, 0, G_OPTION_ARG_FILENAME, &css, NULL, NULL },
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &filenames, NULL, NULL },
{ NULL, }
};
GError *error = NULL;
context = g_option_context_new (NULL);
g_option_context_set_help_enabled (context, FALSE);
g_option_context_add_main_entries (context, entries, NULL);
if (!g_option_context_parse (context, argc, (char ***)argv, &error))
{
g_printerr ("%s\n", error->message);
g_error_free (error);
exit (1);
}
g_option_context_free (context);
if (filenames == NULL)
{
g_printerr ("No .ui file specified\n");
exit (1);
}
if (g_strv_length (filenames) > 1)
{
g_printerr ("Can only preview a single .ui file\n");
exit (1);
}
preview_file (filenames[0], id, css);
g_strfreev (filenames);
g_free (id);
g_free (css);
}

View File

@ -0,0 +1,872 @@
/* Copyright 2015 Red Hat, Inc.
*
* GTK+ is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* GLib 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with GTK+; see the file COPYING. If not,
* see <http://www.gnu.org/licenses/>.
*
* Author: Matthias Clasen
*/
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <glib/gi18n.h>
#include <glib/gprintf.h>
#include <glib/gstdio.h>
#include <gtk/gtk.h>
#include "gtkbuilderprivate.h"
typedef struct Element Element;
struct Element {
Element *parent;
char *element_name;
char **attribute_names;
char **attribute_values;
char *data;
GList *children;
};
static void
free_element (gpointer data)
{
Element *element = data;
g_list_free_full (element->children, free_element);
g_free (element->element_name);
g_strfreev (element->attribute_names);
g_strfreev (element->attribute_values);
g_free (element->data);
g_free (element);
}
typedef struct {
Element *root;
Element *current;
GString *value;
GtkBuilder *builder;
const char *input_filename;
char *output_filename;
FILE *output;
gboolean convert3to4;
} MyParserData;
static void
start_element (GMarkupParseContext *context,
const char *element_name,
const char **attribute_names,
const char **attribute_values,
gpointer user_data,
GError **error)
{
MyParserData *data = user_data;
Element *elt;
elt = g_new0 (Element, 1);
elt->parent = data->current;
elt->element_name = g_strdup (element_name);
elt->attribute_names = g_strdupv ((char **)attribute_names);
elt->attribute_values = g_strdupv ((char **)attribute_values);
if (data->current)
data->current->children = g_list_append (data->current->children, elt);
data->current = elt;
if (data->root == NULL)
data->root = elt;
g_string_truncate (data->value, 0);
}
static void
end_element (GMarkupParseContext *context,
const char *element_name,
gpointer user_data,
GError **error)
{
MyParserData *data = user_data;
data->current->data = g_strdup (data->value->str);
data->current = data->current->parent;
}
static void
text (GMarkupParseContext *context,
const char *text,
gsize text_len,
gpointer user_data,
GError **error)
{
MyParserData *data = user_data;
if (data->value)
{
g_string_append_len (data->value, text, text_len);
return;
}
}
static GMarkupParser parser = {
start_element,
end_element,
text,
NULL,
NULL
};
static const gchar *
canonical_boolean_value (MyParserData *data,
const gchar *string)
{
GValue value = G_VALUE_INIT;
gboolean b = FALSE;
if (gtk_builder_value_from_string_type (data->builder, G_TYPE_BOOLEAN, string, &value, NULL))
b = g_value_get_boolean (&value);
return b ? "1" : "0";
}
/* A number of properties unfortunately can't be omitted even
* if they are nominally set to their default value. In many
* cases, this is due to subclasses not overriding the default
* value from the superclass.
*/
static gboolean
needs_explicit_setting (const gchar *class_name,
const gchar *property_name,
gboolean packing)
{
struct _Prop {
const char *class;
const char *property;
gboolean packing;
} props[] = {
{ "GtkAboutDialog", "program-name", 0 },
{ "GtkCalendar", "year", 0 },
{ "GtkCalendar", "month", 0 },
{ "GtkCalendar", "day", 0 },
{ "GtkPlacesSidebar", "show-desktop", 0 },
{ "GtkRadioButton", "draw-indicator", 0 },
{ "GtkGrid", "left-attach", 1 },
{ "GtkGrid", "top-attach", 1 },
{ "GtkWidget", "hexpand", 0 },
{ "GtkWidget", "vexpand", 0 },
};
gchar *canonical_name;
gboolean found;
gint k;
canonical_name = g_strdup (property_name);
g_strdelimit (canonical_name, "_", '-');
found = FALSE;
for (k = 0; k < G_N_ELEMENTS (props); k++)
{
if (strcmp (class_name, props[k].class) == 0 &&
strcmp (canonical_name, props[k].property) == 0 &&
packing == props[k].packing)
{
found = TRUE;
break;
}
}
g_free (canonical_name);
return found;
}
static gboolean
is_pcdata_element (Element *element)
{
/* elements that can contain text */
const char *names[] = {
"property",
"attribute",
"action-widget",
"pattern",
"mime-type",
"col",
"item",
NULL,
};
if (g_str_equal (element->element_name, "property") &&
(g_strv_contains ((const char * const *)element->attribute_names, "bind-source") ||
g_strv_contains ((const char * const *)element->attribute_names, "bind_source")))
return FALSE;
if (g_strv_contains (names, element->element_name))
return TRUE;
return FALSE;
}
static gboolean
is_container_element (Element *element)
{
/* elements that just hold a list of things and
* can be omitted when they have no children
*/
const char *names[] = {
"packing",
"cell-packing",
"attributes",
"action-widgets",
"patterns",
"mime-types",
"attributes",
"row",
"items",
NULL
};
if (g_strv_contains (names, element->element_name))
return TRUE;
return FALSE;
}
static void
canonicalize_key (gchar *key)
{
gchar *p;
for (p = key; *p != 0; p++)
{
gchar c = *p;
/* We may meet something like AtkObject::accessible-name */
if (c == ':' && ((p > key && p[-1] == ':') || p[1] == ':'))
continue;
if (c != '-' &&
(c < '0' || c > '9') &&
(c < 'A' || c > 'Z') &&
(c < 'a' || c > 'z'))
*p = '-';
}
}
static GParamSpec *
get_property_pspec (MyParserData *data,
const gchar *class_name,
const gchar *property_name,
gboolean packing,
gboolean cell_packing)
{
GType type;
GObjectClass *class;
GParamSpec *pspec;
gchar *canonical_name;
type = g_type_from_name (class_name);
if (type == G_TYPE_INVALID)
{
type = gtk_builder_get_type_from_name (data->builder, class_name);
if (type == G_TYPE_INVALID)
return NULL;
}
class = g_type_class_ref (type);
canonical_name = g_strdup (property_name);
canonicalize_key (canonical_name);
if (packing)
pspec = gtk_container_class_find_child_property (class, canonical_name);
else if (cell_packing)
{
GObjectClass *cell_class;
/* We're just assuming that the cell layout is using a GtkCellAreaBox. */
cell_class = g_type_class_ref (GTK_TYPE_CELL_AREA_BOX);
pspec = gtk_cell_area_class_find_cell_property (GTK_CELL_AREA_CLASS (cell_class), canonical_name);
g_type_class_unref (cell_class);
}
else
pspec = g_object_class_find_property (class, canonical_name);
g_free (canonical_name);
g_type_class_unref (class);
return pspec;
}
static gboolean
value_is_default (MyParserData *data,
const gchar *class_name,
const gchar *property_name,
const gchar *value_string,
gboolean packing,
gboolean cell_packing)
{
GValue value = { 0, };
gboolean ret;
GError *error = NULL;
GParamSpec *pspec;
pspec = get_property_pspec (data, class_name, property_name, packing, cell_packing);
if (pspec == NULL)
{
if (packing)
g_printerr (_("%s: Packing property %s::%s not found\n"), data->input_filename, class_name, property_name);
else if (cell_packing)
g_printerr (_("%s: Cell property %s::%s not found\n"), data->input_filename, class_name, property_name);
else
g_printerr (_("%s: Property %s::%s not found\n"), data->input_filename, class_name, property_name);
return FALSE;
}
else if (g_type_is_a (G_PARAM_SPEC_VALUE_TYPE (pspec), G_TYPE_OBJECT))
return FALSE;
if (!gtk_builder_value_from_string (data->builder, pspec, value_string, &value, &error))
{
g_printerr (_("%s: Couldnt parse value for %s::%s: %s\n"), data->input_filename, class_name, property_name, error->message);
g_error_free (error);
ret = FALSE;
}
else
ret = g_param_value_defaults (pspec, &value);
g_value_reset (&value);
return ret;
}
static const char *
get_class_name (Element *element)
{
Element *parent = element->parent;
int i;
if (g_str_equal (element->element_name, "object"))
parent = element;
if (g_str_equal (parent->element_name, "packing"))
parent = parent->parent->parent; /* child - object */
if (g_str_equal (parent->element_name, "object"))
{
for (i = 0; parent->attribute_names[i]; i++)
{
if (g_str_equal (parent->attribute_names[i], "class"))
return parent->attribute_values[i];
}
}
else if (g_str_equal (parent->element_name, "template"))
{
for (i = 0; parent->attribute_names[i]; i++)
{
if (g_str_equal (parent->attribute_names[i], "parent"))
return parent->attribute_values[i];
}
}
return NULL;
}
static gboolean
property_is_boolean (Element *element,
MyParserData *data)
{
GParamSpec *pspec;
gboolean packing = FALSE;
const char *class_name;
const char *property_name;
int i;
if (g_str_equal (element->parent->element_name, "packing"))
packing = TRUE;
class_name = get_class_name (element);
property_name = "";
for (i = 0; element->attribute_names[i]; i++)
{
if (strcmp (element->attribute_names[i], "name") == 0)
property_name = (const gchar *)element->attribute_values[i];
}
pspec = get_property_pspec (data, class_name, property_name, packing, FALSE);
if (pspec)
return G_PARAM_SPEC_VALUE_TYPE (pspec) == G_TYPE_BOOLEAN;
return FALSE;
}
static gboolean
property_can_be_omitted (Element *element,
MyParserData *data)
{
gint i;
gboolean bound;
gboolean translatable;
const gchar *class_name;
const gchar *property_name;
const gchar *value_string;
gboolean packing = FALSE;
gboolean cell_packing = FALSE;
if (g_str_equal (element->parent->element_name, "packing"))
packing = TRUE;
if (g_str_equal (element->parent->element_name, "cell-packing"))
cell_packing = TRUE;
class_name = get_class_name (element);
property_name = "";
value_string = element->data;
bound = FALSE;
translatable = FALSE;
for (i = 0; element->attribute_names[i]; i++)
{
if (strcmp (element->attribute_names[i], "bind-source") == 0 ||
strcmp (element->attribute_names[i], "bind_source") == 0)
bound = TRUE;
else if (strcmp (element->attribute_names[i], "translatable") == 0)
translatable = TRUE;
else if (strcmp (element->attribute_names[i], "name") == 0)
property_name = (const gchar *)element->attribute_values[i];
}
if (translatable)
return FALSE;
if (bound)
return FALSE;
if (needs_explicit_setting (class_name, property_name, packing))
return FALSE;
return value_is_default (data, class_name, property_name, value_string, packing, cell_packing);
}
static gboolean
property_has_been_removed (Element *element,
MyParserData *data)
{
const gchar *class_name;
const gchar *property_name;
gboolean packing = FALSE;
struct _Prop {
const char *class;
const char *property;
gboolean packing;
} props[] = {
{ "GtkActionBar", "position", 1 },
{ "GtkButtonBox", "secondary", 1 },
{ "GtkButtonBox", "non-homogeneous", 1 },
{ "GtkBox", "pack-type", 1 },
{ "GtkBox", "position", 1 },
{ "GtkHeaderBar", "position", 1 },
{ "GtkPopoverMenu", "position", 1 },
{ "GtkMenu", "left-attach", 1 },
{ "GtkMenu", "right-attach", 1 },
{ "GtkMenu", "top-attach", 1 },
{ "GtkMenu", "bottom-attach", 1 }
};
gchar *canonical_name;
gboolean found;
gint i, k;
if (g_str_equal (element->parent->element_name, "packing"))
packing = TRUE;
class_name = get_class_name (element);
property_name = "";
for (i = 0; element->attribute_names[i]; i++)
{
if (strcmp (element->attribute_names[i], "name") == 0)
property_name = (const gchar *)element->attribute_values[i];
}
canonical_name = g_strdup (property_name);
g_strdelimit (canonical_name, "_", '-');
found = FALSE;
for (k = 0; k < G_N_ELEMENTS (props); k++)
{
if (strcmp (class_name, props[k].class) == 0 &&
strcmp (canonical_name, props[k].property) == 0 &&
packing == props[k].packing)
{
found = TRUE;
break;
}
}
g_free (canonical_name);
return found;
}
static Element *
rewrite_stack_child (Element *child, MyParserData *data)
{
Element *object = NULL;
Element *packing = NULL;
Element *new_object;
Element *prop;
GList *l;
if (!g_str_equal (child->element_name, "child"))
return child;
for (l = child->children; l; l = l->next)
{
Element *elt = l->data;
if (g_str_equal (elt->element_name, "object"))
object = elt;
else if (g_str_equal (elt->element_name, "packing"))
packing = elt;
}
if (!packing)
return child;
new_object = g_new0 (Element, 1);
new_object->element_name = g_strdup ("object");
new_object->attribute_names = g_new0 (char *, 2);
new_object->attribute_names[0] = g_strdup ("class");
new_object->attribute_values = g_new0 (char *, 2);
new_object->attribute_values[0] = g_strdup ("GtkStackPage");
new_object->children = packing->children;
packing->children = NULL;
prop = g_new0 (Element, 1);
prop->element_name = g_strdup ("property");
prop->attribute_names = g_new0 (char *, 2);
prop->attribute_names[0] = g_strdup ("name");
prop->attribute_values = g_new0 (char *, 2);
prop->attribute_values[0] = g_strdup ("child");
prop->children = g_list_append (prop->children, object);
new_object->children = g_list_append (new_object->children, prop);
g_list_free (child->children);
child->children = g_list_append (NULL, new_object);
return child;
}
static void
rewrite_stack (Element *element,
MyParserData *data)
{
GList *l, *new_children;
new_children = NULL;
for (l = element->children; l; l = l->next)
{
Element *child = l->data;
new_children = g_list_append (new_children, rewrite_stack_child (child, data));
}
g_list_free (element->children);
element->children = new_children;
}
static Element *
rewrite_assistant_child (Element *child, MyParserData *data)
{
Element *object = NULL;
Element *packing = NULL;
Element *new_object;
Element *prop;
GList *l;
if (!g_str_equal (child->element_name, "child"))
return child;
for (l = child->children; l; l = l->next)
{
Element *elt = l->data;
if (g_str_equal (elt->element_name, "object"))
object = elt;
else if (g_str_equal (elt->element_name, "packing"))
packing = elt;
}
if (!packing)
return child;
new_object = g_new0 (Element, 1);
new_object->element_name = g_strdup ("object");
new_object->attribute_names = g_new0 (char *, 2);
new_object->attribute_names[0] = g_strdup ("class");
new_object->attribute_values = g_new0 (char *, 2);
new_object->attribute_values[0] = g_strdup ("GtkAssistantPage");
new_object->children = packing->children;
packing->children = NULL;
prop = g_new0 (Element, 1);
prop->element_name = g_strdup ("property");
prop->attribute_names = g_new0 (char *, 2);
prop->attribute_names[0] = g_strdup ("name");
prop->attribute_values = g_new0 (char *, 2);
prop->attribute_values[0] = g_strdup ("child");
prop->children = g_list_append (prop->children, object);
new_object->children = g_list_append (new_object->children, prop);
g_list_free (child->children);
child->children = g_list_append (NULL, new_object);
return child;
}
static void
rewrite_assistant (Element *element,
MyParserData *data)
{
GList *l, *new_children;
new_children = NULL;
for (l = element->children; l; l = l->next)
{
Element *child = l->data;
new_children = g_list_append (new_children, rewrite_assistant_child (child, data));
}
g_list_free (element->children);
element->children = new_children;
}
static gboolean
simplify_element (Element *element,
MyParserData *data)
{
GList *l;
if (!is_pcdata_element (element))
g_clear_pointer (&element->data, g_free);
else if (g_str_equal (element->element_name, "property") &&
property_is_boolean (element, data))
{
const char *b = canonical_boolean_value (data, element->data);
g_free (element->data);
element->data = g_strdup (b);
}
l = element->children;
while (l)
{
GList *next = l->next;
Element *child = l->data;
if (simplify_element (child, data))
{
element->children = g_list_remove (element->children, child);
free_element (child);
}
l = next;
}
if (is_container_element (element) && element->children == NULL)
return TRUE;
if (g_str_equal (element->element_name, "property") &&
property_can_be_omitted (element, data))
return TRUE;
if (data->convert3to4)
{
if (g_str_equal (element->element_name, "object") &&
g_str_equal (get_class_name (element), "GtkStack"))
rewrite_stack (element, data);
if (g_str_equal (element->element_name, "object") &&
g_str_equal (get_class_name (element), "GtkAssistant"))
rewrite_assistant (element, data);
if (g_str_equal (element->element_name, "property") &&
property_has_been_removed (element, data))
return TRUE;
}
return FALSE;
}
static void
simplify_tree (MyParserData *data)
{
simplify_element (data->root, data);
}
static void
dump_element (Element *element,
FILE *output,
int indent)
{
g_fprintf (output, "%*s<%s", indent, "", element->element_name);
if (element->attribute_names[0])
{
int i;
for (i = 0; element->attribute_names[i]; i++)
{
char *escaped = g_markup_escape_text (element->attribute_values[i], -1);
g_fprintf (output, " %s=\"%s\"", element->attribute_names[i], escaped);
g_free (escaped);
}
}
if (element->children || element->data)
{
g_fprintf (output, ">");
if (element->children)
{
GList *l;
g_fprintf (output, "\n");
for (l = element->children; l; l = l->next)
{
Element *child = l->data;
dump_element (child, output, indent + 2);
}
g_fprintf (output, "%*s", indent, "");
}
else
{
char *escaped = g_markup_escape_text (element->data, -1);
g_fprintf (output, "%s", escaped);
g_free (escaped);
}
g_fprintf (output, "</%s>\n", element->element_name);
}
else
g_fprintf (output, "/>\n");
}
static void
dump_tree (MyParserData *data)
{
dump_element (data->root, data->output, 0);
}
gboolean
simplify_file (const char *filename,
gboolean replace,
gboolean convert3to4)
{
GMarkupParseContext *context;
gchar *buffer;
MyParserData data;
GError *error = NULL;
data.input_filename = filename;
data.output_filename = NULL;
data.convert3to4 = convert3to4;
if (replace)
{
int fd;
fd = g_file_open_tmp ("gtk-builder-tool-XXXXXX", &data.output_filename, NULL);
data.output = fdopen (fd, "w");
}
else
{
data.output = stdout;
}
if (!g_file_get_contents (filename, &buffer, NULL, &error))
{
g_printerr (_("Cant load '%s': %s\n"), filename, error->message);
return FALSE;
}
data.root = NULL;
data.current = NULL;
data.value = g_string_new ("");
context = g_markup_parse_context_new (&parser, G_MARKUP_TREAT_CDATA_AS_TEXT, &data, NULL);
if (!g_markup_parse_context_parse (context, buffer, -1, &error))
{
g_printerr (_("Cant parse '%s': %s\n"), filename, error->message);
return FALSE;
}
data.builder = gtk_builder_new ();
simplify_tree (&data);
dump_tree (&data);
fclose (data.output);
if (data.output_filename)
{
char *content;
gsize length;
if (!g_file_get_contents (data.output_filename, &content, &length, &error))
{
g_printerr (_("Failed to read '%s': %s\n"), data.output_filename, error->message);
return FALSE;
}
if (!g_file_set_contents (data.input_filename, content, length, &error))
{
g_printerr (_("Failed to write %s: '%s'\n"), data.input_filename, error->message);
return FALSE;
}
}
return TRUE;
}
void
do_simplify (int *argc,
const char ***argv)
{
gboolean replace = FALSE;
gboolean convert3to4 = FALSE;
char **filenames = NULL;
GOptionContext *ctx;
const GOptionEntry entries[] = {
{ "replace", 0, 0, G_OPTION_ARG_NONE, &replace, NULL, NULL },
{ "3to4", 0, 0, G_OPTION_ARG_NONE, &convert3to4, NULL, NULL },
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &filenames, NULL, NULL },
{ NULL, }
};
GError *error = NULL;
int i;
ctx = g_option_context_new (NULL);
g_option_context_set_help_enabled (ctx, FALSE);
g_option_context_add_main_entries (ctx, entries, NULL);
if (!g_option_context_parse (ctx, argc, (char ***)argv, &error))
{
g_printerr ("%s\n", error->message);
g_error_free (error);
exit (1);
}
g_option_context_free (ctx);
if (filenames == NULL)
{
g_printerr (_("No .ui file specified\n"));
exit (1);
}
if (g_strv_length (filenames) > 1 && !replace)
{
g_printerr (_("Can only simplify a single .ui file without --replace\n"));
exit (1);
}
for (i = 0; filenames[i]; i++)
{
if (!simplify_file (filenames[i], replace, convert3to4))
exit (1);
}
}

View File

@ -0,0 +1,164 @@
/* Copyright 2015 Red Hat, Inc.
*
* GTK+ is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* GLib 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with GTK+; see the file COPYING. If not,
* see <http://www.gnu.org/licenses/>.
*
* Author: Matthias Clasen
*/
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <glib/gi18n.h>
#include <glib/gprintf.h>
#include <glib/gstdio.h>
#include <gtk/gtk.h>
#include "gtkbuilderprivate.h"
static GType
make_fake_type (const gchar *type_name,
const gchar *parent_name)
{
GType parent_type;
GTypeQuery query;
parent_type = g_type_from_name (parent_name);
if (parent_type == G_TYPE_INVALID)
{
g_printerr ("Failed to lookup template parent type %s\n", parent_name);
exit (1);
}
g_type_query (parent_type, &query);
return g_type_register_static_simple (parent_type,
type_name,
query.class_size,
NULL,
query.instance_size,
NULL,
0);
}
static void
do_validate_template (const gchar *filename,
const gchar *type_name,
const gchar *parent_name)
{
GType template_type;
GtkWidget *widget;
GtkBuilder *builder;
GError *error = NULL;
gint ret;
/* Only make a fake type if it doesn't exist yet.
* This lets us e.g. validate the GtkFileChooserWidget template.
*/
template_type = g_type_from_name (type_name);
if (template_type == G_TYPE_INVALID)
template_type = make_fake_type (type_name, parent_name);
widget = g_object_new (template_type, NULL);
if (!widget)
{
g_printerr ("Failed to create an instance of the template type %s\n", type_name);
exit (1);
}
builder = gtk_builder_new ();
ret = gtk_builder_extend_with_template (builder, widget, template_type, " ", 1, &error);
if (ret)
ret = gtk_builder_add_from_file (builder, filename, &error);
g_object_unref (builder);
if (ret == 0)
{
g_printerr ("%s\n", error->message);
exit (1);
}
}
static gboolean
parse_template_error (const gchar *message,
gchar **class_name,
gchar **parent_name)
{
gchar *p;
if (!strstr (message, "Not expecting to handle a template"))
return FALSE;
p = strstr (message, "(class '");
if (p)
{
*class_name = g_strdup (p + strlen ("(class '"));
p = strstr (*class_name, "'");
if (p)
*p = '\0';
}
p = strstr (message, ", parent '");
if (p)
{
*parent_name = g_strdup (p + strlen (", parent '"));
p = strstr (*parent_name, "'");
if (p)
*p = '\0';
}
return TRUE;
}
static gboolean
validate_file (const char *filename)
{
GtkBuilder *builder;
GError *error = NULL;
gint ret;
gchar *class_name = NULL;
gchar *parent_name = NULL;
builder = gtk_builder_new ();
ret = gtk_builder_add_from_file (builder, filename, &error);
g_object_unref (builder);
if (ret == 0)
{
if (g_error_matches (error, GTK_BUILDER_ERROR, GTK_BUILDER_ERROR_UNHANDLED_TAG) &&
parse_template_error (error->message, &class_name, &parent_name))
{
do_validate_template (filename, class_name, parent_name);
}
else
{
g_printerr ("%s: %s\n", filename, error->message);
return FALSE;
}
}
return TRUE;
}
void
do_validate (int *argc, char ***argv)
{
int i;
for (i = 1; i < *argc; i++)
{
if (!validate_file ((*argv)[i]))
exit (1);
}
return;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,11 @@
# Installed tools
gtk_tools = [
['gtk4-query-settings', ['gtk-query-settings.c']],
['gtk4-builder-tool', ['gtk-builder-tool.c']],
['gtk4-builder-tool', ['gtk-builder-tool.c',
'gtk-builder-tool-simplify.c',
'gtk-builder-tool-validate.c',
'gtk-builder-tool-enumerate.c',
'gtk-builder-tool-preview.c']],
['gtk4-update-icon-cache', ['updateiconcache.c', 'gtkiconcachevalidator.c']],
['gtk4-encode-symbolic-svg', ['encodesymbolic.c', 'gdkpixbufutils.c']],
]

View File

@ -1,6 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="gtk40">
<!-- interface-requires gtk+ 3.10 -->
<template class="GtkAboutDialog" parent="GtkDialog">
<property name="resizable">0</property>
<property name="type-hint">dialog</property>
@ -47,179 +45,187 @@
<property name="vexpand">1</property>
<signal name="notify::visible-child" handler="stack_visible_child_notify" swapped="no"/>
<child>
<object class="GtkBox" id="page_vbox">
<property name="orientation">vertical</property>
<property name="spacing">8</property>
<child>
<object class="GtkLabel" id="version_label">
<property name="visible">0</property>
<property name="label">version 1.0</property>
<property name="justify">center</property>
<property name="selectable">1</property>
</object>
</child>
<child>
<object class="GtkLabel" id="comments_label">
<property name="visible">0</property>
<property name="label">comments</property>
<property name="justify">center</property>
<property name="wrap">1</property>
<property name="selectable">1</property>
<property name="max-width-chars">60</property>
</object>
</child>
<child>
<object class="GtkLabel" id="website_label">
<property name="visible">0</property>
<property name="label">http://website.com</property>
<property name="selectable">1</property>
<signal name="activate-link" handler="emit_activate_link" object="GtkAboutDialog" swapped="yes"/>
</object>
</child>
<child>
<object class="GtkLabel" id="copyright_label">
<property name="visible">0</property>
<property name="label">copyright</property>
<property name="justify">center</property>
<property name="wrap">1</property>
<property name="selectable">1</property>
<property name="max-width-chars">60</property>
</object>
</child>
<child>
<object class="GtkLabel" id="license_label">
<property name="visible">0</property>
<property name="label">license</property>
<property name="use-markup">1</property>
<property name="justify">center</property>
<property name="wrap">1</property>
<property name="selectable">1</property>
<property name="max-width-chars">60</property>
<signal name="activate-link" handler="emit_activate_link" object="GtkAboutDialog" swapped="yes"/>
</object>
</child>
</object>
<packing>
<object class="GtkStackPage">
<property name="name">main</property>
<property name="title" translatable="yes">About</property>
</packing>
</child>
<child>
<object class="GtkBox" id="credits_page">
<property name="visible">0</property>
<property name="orientation">vertical</property>
<property name="spacing">8</property>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="hscrollbar-policy">never</property>
<property name="shadow-type">in</property>
<property name="vexpand">1</property>
<property name="child">
<object class="GtkBox" id="page_vbox">
<property name="orientation">vertical</property>
<property name="spacing">8</property>
<child>
<object class="GtkViewport" id="viewport1">
<style>
<class name="view"/>
</style>
<child>
<object class="GtkGrid" id="credits_grid">
<property name="halign">center</property>
<property name="valign">start</property>
<property name="orientation">vertical</property>
<property name="row-spacing">2</property>
<property name="column-spacing">8</property>
<property name="margin">5</property>
</object>
</child>
<object class="GtkLabel" id="version_label">
<property name="visible">0</property>
<property name="label">version 1.0</property>
<property name="justify">center</property>
<property name="selectable">1</property>
</object>
</child>
<child>
<object class="GtkLabel" id="comments_label">
<property name="visible">0</property>
<property name="label">comments</property>
<property name="justify">center</property>
<property name="wrap">1</property>
<property name="selectable">1</property>
<property name="max-width-chars">60</property>
</object>
</child>
<child>
<object class="GtkLabel" id="website_label">
<property name="visible">0</property>
<property name="label">http://website.com</property>
<property name="selectable">1</property>
<signal name="activate-link" handler="emit_activate_link" object="GtkAboutDialog" swapped="yes"/>
</object>
</child>
<child>
<object class="GtkLabel" id="copyright_label">
<property name="visible">0</property>
<property name="label">copyright</property>
<property name="justify">center</property>
<property name="wrap">1</property>
<property name="selectable">1</property>
<property name="max-width-chars">60</property>
</object>
</child>
<child>
<object class="GtkLabel" id="license_label">
<property name="visible">0</property>
<property name="label">license</property>
<property name="use-markup">1</property>
<property name="justify">center</property>
<property name="wrap">1</property>
<property name="selectable">1</property>
<property name="max-width-chars">60</property>
<signal name="activate-link" handler="emit_activate_link" object="GtkAboutDialog" swapped="yes"/>
</object>
</child>
</object>
</child>
</property>
</object>
<packing>
</child>
<child>
<object class="GtkStackPage">
<property name="name">credits</property>
<property name="title" translatable="yes">Credits</property>
</packing>
</child>
<child>
<object class="GtkBox" id="license_page">
<property name="visible">0</property>
<property name="orientation">vertical</property>
<property name="spacing">8</property>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow2">
<property name="hscrollbar-policy">never</property>
<property name="shadow-type">in</property>
<property name="vexpand">1</property>
<property name="child">
<object class="GtkBox" id="credits_page">
<property name="visible">0</property>
<property name="orientation">vertical</property>
<property name="spacing">8</property>
<child>
<object class="GtkTextView" id="license_view">
<property name="editable">0</property>
<property name="left-margin">8</property>
<property name="right-margin">8</property>
<property name="cursor-visible">0</property>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="hscrollbar-policy">never</property>
<property name="shadow-type">in</property>
<property name="vexpand">1</property>
<child>
<object class="GtkGestureMultiPress">
<signal name="released" handler="text_view_released" swapped="no"/>
</object>
</child>
<child>
<object class="GtkEventControllerMotion">
<signal name="motion" handler="text_view_motion" swapped="no"/>
</object>
</child>
<child>
<object class="GtkEventControllerKey">
<signal name="key-pressed" handler="text_view_key_pressed" swapped="no"/>
<object class="GtkViewport" id="viewport1">
<style>
<class name="view"/>
</style>
<child>
<object class="GtkGrid" id="credits_grid">
<property name="halign">center</property>
<property name="valign">start</property>
<property name="orientation">vertical</property>
<property name="row-spacing">2</property>
<property name="column-spacing">8</property>
<property name="margin">5</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</property>
</object>
<packing>
</child>
<child>
<object class="GtkStackPage">
<property name="name">license</property>
<property name="title" translatable="yes">License</property>
</packing>
</child>
<child>
<object class="GtkBox" id="system_page">
<property name="visible">0</property>
<property name="orientation">vertical</property>
<property name="spacing">8</property>
<child>
<object class="GtkScrolledWindow">
<property name="hscrollbar-policy">never</property>
<property name="shadow-type">in</property>
<property name="vexpand">1</property>
<property name="child">
<object class="GtkBox" id="license_page">
<property name="visible">0</property>
<property name="orientation">vertical</property>
<property name="spacing">8</property>
<child>
<object class="GtkTextView" id="system_view">
<property name="editable">0</property>
<property name="left-margin">8</property>
<property name="right-margin">8</property>
<property name="cursor-visible">0</property>
<object class="GtkScrolledWindow" id="scrolledwindow2">
<property name="hscrollbar-policy">never</property>
<property name="shadow-type">in</property>
<property name="vexpand">1</property>
<child>
<object class="GtkGestureMultiPress">
<signal name="released" handler="text_view_released" swapped="no"/>
</object>
</child>
<child>
<object class="GtkEventControllerMotion">
<signal name="motion" handler="text_view_motion" swapped="no"/>
</object>
</child>
<child>
<object class="GtkEventControllerKey">
<signal name="key-pressed" handler="text_view_key_pressed" swapped="no"/>
<object class="GtkTextView" id="license_view">
<property name="editable">0</property>
<property name="left-margin">8</property>
<property name="right-margin">8</property>
<property name="cursor-visible">0</property>
<child>
<object class="GtkGestureMultiPress">
<signal name="released" handler="text_view_released" swapped="no"/>
</object>
</child>
<child>
<object class="GtkEventControllerMotion">
<signal name="motion" handler="text_view_motion" swapped="no"/>
</object>
</child>
<child>
<object class="GtkEventControllerKey">
<signal name="key-pressed" handler="text_view_key_pressed" swapped="no"/>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</property>
</object>
<packing>
</child>
<child>
<object class="GtkStackPage">
<property name="name">system</property>
<property name="title" translatable="yes">System</property>
</packing>
<property name="child">
<object class="GtkBox" id="system_page">
<property name="visible">0</property>
<property name="orientation">vertical</property>
<property name="spacing">8</property>
<child>
<object class="GtkScrolledWindow">
<property name="hscrollbar-policy">never</property>
<property name="shadow-type">in</property>
<property name="vexpand">1</property>
<child>
<object class="GtkTextView" id="system_view">
<property name="editable">0</property>
<property name="left-margin">8</property>
<property name="right-margin">8</property>
<property name="cursor-visible">0</property>
<child>
<object class="GtkGestureMultiPress">
<signal name="released" handler="text_view_released" swapped="no"/>
</object>
</child>
<child>
<object class="GtkEventControllerMotion">
<signal name="motion" handler="text_view_motion" swapped="no"/>
</object>
</child>
<child>
<object class="GtkEventControllerKey">
<signal name="key-pressed" handler="text_view_key_pressed" swapped="no"/>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</property>
</object>
</child>
</object>
</child>

View File

@ -1,6 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="gtk40">
<!-- interface-requires gtk+ 3.10 -->
<template class="GtkAppChooserDialog" parent="GtkDialog">
<property name="title" translatable="yes">Select Application</property>
<property name="type-hint">dialog</property>

View File

@ -1,27 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="gtk40">
<!-- interface-requires gtk+ 3.10 -->
<object class="GtkListStore" id="program_list_store">
<columns>
<!-- column-name app-info -->
<column type="GAppInfo"/>
<!-- column-name app-icon -->
<column type="GIcon"/>
<!-- column-name name -->
<column type="gchararray"/>
<!-- column-name description -->
<column type="gchararray"/>
<!-- column-name exec -->
<column type="gchararray"/>
<!-- column-name default -->
<column type="gboolean"/>
<!-- column-name heading -->
<column type="gboolean"/>
<!-- column-name heading-text -->
<column type="gchararray"/>
<!-- column-name recommended -->
<column type="gboolean"/>
<!-- column-name fallback -->
<column type="gboolean"/>
</columns>
</object>
@ -112,7 +100,7 @@
<property name="valign">center</property>
<property name="wrap">1</property>
<attributes>
<attribute name="scale" value="1.2"/>
<attribute name="scale" value="1.2"></attribute>
</attributes>
<style>
<class name="dim-label"/>

View File

@ -1,9 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="gtk40">
<menu id="app-menu">
<section>
<item>
<!-- used for the application menu on MacOS. %s is replaced with the application name. -->
<attribute name="label" translatable="yes">About %s</attribute>
<attribute name="action">app.about</attribute>
<attribute name="x-gtk-private-special">replace-appname</attribute>
@ -11,33 +9,28 @@
</section>
<section>
<item>
<!-- used for the application menu on MacOS -->
<attribute name="label" translatable="yes">Preferences</attribute>
<attribute name="action">app.preferences</attribute>
</item>
</section>
<section>
<item>
<!-- used for the application menu on MacOS -->
<attribute name="label" translatable="yes">Services</attribute>
<attribute name="x-gtk-private-special">services-submenu</attribute>
</item>
</section>
<section>
<item>
<!-- used for the application menu on MacOS. %s is replaced with the application name. -->
<attribute name="label" translatable="yes">Hide %s</attribute>
<attribute name="x-gtk-private-special">hide-this</attribute>
<attribute name="action">gtkinternal.hide</attribute>
</item>
<item>
<!-- used for the application menu on MacOS -->
<attribute name="label" translatable="yes">Hide Others</attribute>
<attribute name="x-gtk-private-special">hide-others</attribute>
<attribute name="action">gtkinternal.hide-others</attribute>
</item>
<item>
<!-- used for the application menu on MacOS -->
<attribute name="label" translatable="yes">Show All</attribute>
<attribute name="x-gtk-private-special">show-all</attribute>
<attribute name="action">gtkinternal.show-all</attribute>
@ -45,7 +38,6 @@
</section>
<section>
<item>
<!-- used for the application menu on MacOS. %s is replaced with the application name. -->
<attribute name="label" translatable="yes">Quit %s</attribute>
<attribute name="action">app.quit</attribute>
<attribute name="x-gtk-private-special">replace-appname</attribute>

View File

@ -1,6 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="gtk40">
<!-- interface-requires gtk+ 3.10 -->
<template class="GtkAssistant" parent="GtkWindow">
<child type="titlebar">
<object class="GtkHeaderBar" id="headerbar"/>

View File

@ -1,6 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="gtk40">
<!-- interface-requires gtk+ 3.10 -->
<template class="GtkColorChooserDialog" parent="GtkDialog">
<property name="title" translatable="yes">Select a Color</property>
<property name="type-hint">dialog</property>

View File

@ -1,7 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="gtk40">
<!-- interface-requires gtkprivate 3.10 -->
<!-- interface-requires gtk+ 3.10 -->
<object class="GtkAdjustment" id="a_adj">
<property name="upper">1</property>
<property name="step-increment">0.01</property>
@ -27,7 +24,6 @@
<signal name="value-changed" handler="hsv_changed" object="GtkColorEditor" swapped="yes"/>
</object>
<template class="GtkColorEditor" parent="GtkBox">
<property name="can-focus">False</property>
<signal name="notify::visible" handler="dismiss_current_popup" swapped="no"/>
<child>
<object class="GtkOverlay" id="overlay">

View File

@ -1,6 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="gtk40">
<!-- interface-requires gtk+ 3.10 -->
<template class="GtkComboBox" parent="GtkBin">
<child>
<object class="GtkBox" id="box">

Some files were not shown because too many files have changed in this diff Show More