[gtk/child-properties-be-gone: 5/10] gtk-demo: Stop using child properties
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/child-properties-be-gone: 5/10] gtk-demo: Stop using child properties
- Date: Fri, 5 Apr 2019 04:06:44 +0000 (UTC)
commit fa2a58accde1db55da7ccf2cecf01acb166b39f4
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Apr 5 03:59:06 2019 +0000
gtk-demo: Stop using child properties
demos/gtk-demo/panes.c | 28 ++++++++++++++++++++--------
demos/gtk-demo/sliding_puzzle.c | 12 ++++++++----
2 files changed, 28 insertions(+), 12 deletions(-)
---
diff --git a/demos/gtk-demo/panes.c b/demos/gtk-demo/panes.c
index 675bc5d9ea..e023cd22ba 100644
--- a/demos/gtk-demo/panes.c
+++ b/demos/gtk-demo/panes.c
@@ -27,10 +27,16 @@ toggle_resize (GtkWidget *widget,
is_child1 = (child == gtk_paned_get_child1 (paned));
- gtk_container_child_get (GTK_CONTAINER (paned), child,
- "resize", &resize,
- "shrink", &shrink,
- NULL);
+ if (is_child1)
+ g_object_get (paned,
+ "resize-child1", &resize,
+ "shrink-child1", &shrink,
+ NULL);
+ else
+ g_object_get (paned,
+ "resize-child2", &resize,
+ "shrink-child2", &shrink,
+ NULL);
g_object_ref (child);
gtk_container_remove (GTK_CONTAINER (parent), child);
@@ -55,10 +61,16 @@ toggle_shrink (GtkWidget *widget,
is_child1 = (child == gtk_paned_get_child1 (paned));
- gtk_container_child_get (GTK_CONTAINER (paned), child,
- "resize", &resize,
- "shrink", &shrink,
- NULL);
+ if (is_child1)
+ g_object_get (paned,
+ "resize-child1", &resize,
+ "shrink-child1", &shrink,
+ NULL);
+ else
+ g_object_get (paned,
+ "resize-child2", &resize,
+ "shrink-child2", &shrink,
+ NULL);
g_object_ref (child);
gtk_container_remove (GTK_CONTAINER (parent), child);
diff --git a/demos/gtk-demo/sliding_puzzle.c b/demos/gtk-demo/sliding_puzzle.c
index 60762342c9..1f1bff9a05 100644
--- a/demos/gtk-demo/sliding_puzzle.c
+++ b/demos/gtk-demo/sliding_puzzle.c
@@ -224,6 +224,8 @@ puzzle_button_pressed (GtkGestureMultiPress *gesture,
double y,
GtkWidget *grid)
{
+ GtkLayoutManager *layout_manager;
+ GtkLayoutChild *layout_child;
GtkWidget *child;
int l, t, i;
int pos;
@@ -236,10 +238,12 @@ puzzle_button_pressed (GtkGestureMultiPress *gesture,
return;
}
- gtk_container_child_get (GTK_CONTAINER (grid), child,
- "left-attach", &l,
- "top-attach", &t,
- NULL);
+ layout_manager = gtk_widget_get_layout_manager (grid);
+ layout_child = gtk_layout_manager_get_layout_child (layout_manager, child);
+ g_object_get (layout_child,
+ "left-attach", &l,
+ "top-attach", &t,
+ NULL);
if (l == pos_x && t == pos_y)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]