mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-13 05:50:10 +00:00
widget-factory: Add some row activation to the listbox example
This shows some fallout from the gesture conversion.
This commit is contained in:
parent
5051dc5a90
commit
9b6563dcdc
@ -487,12 +487,28 @@ populate_colors (GtkWidget *widget)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
activate_row3 (GtkListBoxRow *row, GtkWidget *image)
|
||||
{
|
||||
if (gtk_widget_get_opacity (image) > 0)
|
||||
gtk_widget_set_opacity (image, 0);
|
||||
else
|
||||
gtk_widget_set_opacity (image, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
activate_row4 (GtkListBoxRow *row, GtkWidget *dialog)
|
||||
{
|
||||
gtk_window_present (GTK_WINDOW (dialog));
|
||||
}
|
||||
|
||||
static void
|
||||
activate (GApplication *app)
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
GtkWindow *window;
|
||||
GtkWidget *widget;
|
||||
GtkWidget *widget2;
|
||||
GtkWidget *stack;
|
||||
GtkWidget *dialog;
|
||||
GtkAdjustment *adj;
|
||||
@ -540,6 +556,14 @@ activate (GApplication *app)
|
||||
|
||||
widget = (GtkWidget *)gtk_builder_get_object (builder, "listbox");
|
||||
gtk_list_box_set_header_func (GTK_LIST_BOX (widget), update_header, NULL, NULL);
|
||||
widget = gtk_widget_get_parent ((GtkWidget *)gtk_builder_get_object (builder, "listboxrow3"));
|
||||
widget2 = (GtkWidget *)gtk_builder_get_object (builder, "listboxrow3image");
|
||||
g_signal_connect (widget, "activate",
|
||||
G_CALLBACK (activate_row3), widget2);
|
||||
widget = gtk_widget_get_parent ((GtkWidget *)gtk_builder_get_object (builder, "listboxrow4"));
|
||||
widget2 = (GtkWidget *)gtk_builder_get_object (builder, "info_dialog");
|
||||
g_signal_connect (widget, "activate",
|
||||
G_CALLBACK (activate_row4), widget2);
|
||||
|
||||
widget = (GtkWidget *)gtk_builder_get_object (builder, "toolbar");
|
||||
g_object_set_data (G_OBJECT (window), "toolbar", widget);
|
||||
|
@ -2100,6 +2100,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus. </property>
|
||||
<object class="GtkListBox" id="listbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="selection-mode">none</property>
|
||||
<property name="activate-on-single-click">True</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="listboxrow1">
|
||||
<property name="visible">True</property>
|
||||
@ -2107,7 +2108,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus. </property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="label">Row 1</property>
|
||||
<property name="label" translatable="yes">Row 1</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="margin">6</property>
|
||||
</object>
|
||||
@ -2130,7 +2131,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus. </property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="label">Row 2</property>
|
||||
<property name="label" translatable="yes">Row 2</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="margin">6</property>
|
||||
</object>
|
||||
@ -2157,14 +2158,55 @@ Suspendisse feugiat quam quis dolor accumsan cursus. </property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="label">Row 3</property>
|
||||
<property name="label" translatable="yes">Row 3</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="margin">6</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage" id="listboxrow3image">
|
||||
<property name="visible">True</property>
|
||||
<property name="icon-name">object-select-symbolic</property>
|
||||
<property name="icon-size">1</property>
|
||||
<property name="margin">6</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="opacity">0</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="listboxrow4">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">horizontal</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Row 4</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="margin">6</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="icon-name">object-select-symbolic</property>
|
||||
<property name="icon-size">1</property>
|
||||
<property name="margin">6</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="opacity">0</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@ -2816,81 +2858,81 @@ Suspendisse feugiat quam quis dolor accumsan cursus. </property>
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">4</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<property name="vscrollbar-policy">always</property>
|
||||
<property name="height-request">300</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="shadow-type">in</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">4</property>
|
||||
<child>
|
||||
<object class="GtkTreeView" id="charletree">
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="visible">True</property>
|
||||
<property name="enable-grid-lines">vertical</property>
|
||||
<property name="enable-tree-lines">True</property>
|
||||
<property name="rules-hint">True</property>
|
||||
<property name="rubber-banding">True</property>
|
||||
<property name="model">charlemodel</property>
|
||||
<child internal-child="selection">
|
||||
<object class="GtkTreeSelection">
|
||||
<property name="mode">multiple</property>
|
||||
</object>
|
||||
</child>
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<property name="vscrollbar-policy">always</property>
|
||||
<property name="height-request">300</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="shadow-type">in</property>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn">
|
||||
<object class="GtkTreeView" id="charletree">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes">Name</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText"/>
|
||||
<attributes>
|
||||
<attribute name="text">0</attribute>
|
||||
</attributes>
|
||||
<property name="enable-grid-lines">vertical</property>
|
||||
<property name="enable-tree-lines">True</property>
|
||||
<property name="rules-hint">True</property>
|
||||
<property name="rubber-banding">True</property>
|
||||
<property name="model">charlemodel</property>
|
||||
<child internal-child="selection">
|
||||
<object class="GtkTreeSelection">
|
||||
<property name="mode">multiple</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes">Birth</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText"/>
|
||||
<attributes>
|
||||
<attribute name="text">1</attribute>
|
||||
</attributes>
|
||||
<object class="GtkTreeViewColumn">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes">Name</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText"/>
|
||||
<attributes>
|
||||
<attribute name="text">0</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes">Death</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText"/>
|
||||
<attributes>
|
||||
<attribute name="text">2</attribute>
|
||||
</attributes>
|
||||
<object class="GtkTreeViewColumn">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes">Birth</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText"/>
|
||||
<attributes>
|
||||
<attribute name="text">1</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes">Death</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText"/>
|
||||
<attributes>
|
||||
<attribute name="text">2</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="selectable">True</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="use-markup">True</property>
|
||||
<property name="label" translatable="True"><![CDATA[<small>Data source: <a href="http://en.wikipedia.org/wiki/Charlemagne#Ancestry">Wikipedia</a></small>]]></property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="selectable">True</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="use-markup">True</property>
|
||||
<property name="label" translatable="True"><![CDATA[<small>Data source: <a href="http://en.wikipedia.org/wiki/Charlemagne#Ancestry">Wikipedia</a></small>]]></property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@ -3153,6 +3195,7 @@ bad things might happen.</property>
|
||||
<widget name="listboxrow1"/>
|
||||
<widget name="listboxrow2"/>
|
||||
<widget name="listboxrow3"/>
|
||||
<widget name="listboxrow4"/>
|
||||
</widgets>
|
||||
</object>
|
||||
<object class="GtkSizeGroup">
|
||||
|
Loading…
Reference in New Issue
Block a user