Commit 92a1382b authored by Javier Jardón's avatar Javier Jardón

Use accessor functions to access GtkPaned

parent 28cf61a2
......@@ -18,11 +18,13 @@ toggle_resize (GtkWidget *widget,
GtkWidget *child)
{
GtkPaned *paned = GTK_PANED (child->parent);
gboolean is_child1 = (child == paned->child1);
gboolean is_child1 = (child == gtk_paned_get_child1 (paned));
gboolean resize, shrink;
resize = is_child1 ? paned->child1_resize : paned->child2_resize;
shrink = is_child1 ? paned->child1_shrink : paned->child2_shrink;
gtk_container_child_get (GTK_CONTAINER (paned), child,
"resize", &resize,
"shrink", &shrink,
NULL);
g_object_ref (child);
gtk_container_remove (GTK_CONTAINER (child->parent), child);
......@@ -38,11 +40,13 @@ toggle_shrink (GtkWidget *widget,
GtkWidget *child)
{
GtkPaned *paned = GTK_PANED (child->parent);
gboolean is_child1 = (child == paned->child1);
gboolean is_child1 = (child == gtk_paned_get_child1 (paned));
gboolean resize, shrink;
resize = is_child1 ? paned->child1_resize : paned->child2_resize;
shrink = is_child1 ? paned->child1_shrink : paned->child2_shrink;
gtk_container_child_get (GTK_CONTAINER (paned), child,
"resize", &resize,
"shrink", &shrink,
NULL);
g_object_ref (child);
gtk_container_remove (GTK_CONTAINER (child->parent), child);
......@@ -59,11 +63,15 @@ create_pane_options (GtkPaned *paned,
const gchar *label1,
const gchar *label2)
{
GtkWidget *child1, *child2;
GtkWidget *frame;
GtkWidget *table;
GtkWidget *label;
GtkWidget *check_button;
child1 = gtk_paned_get_child1 (paned);
child2 = gtk_paned_get_child2 (paned);
frame = gtk_frame_new (frame_label);
gtk_container_set_border_width (GTK_CONTAINER (frame), 4);
......@@ -78,16 +86,16 @@ create_pane_options (GtkPaned *paned,
gtk_table_attach_defaults (GTK_TABLE (table), check_button,
0, 1, 1, 2);
g_signal_connect (check_button, "toggled",
G_CALLBACK (toggle_resize), paned->child1);
G_CALLBACK (toggle_resize), child1);
check_button = gtk_check_button_new_with_mnemonic ("_Shrink");
gtk_table_attach_defaults (GTK_TABLE (table), check_button,
0, 1, 2, 3);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button),
TRUE);
g_signal_connect (check_button, "toggled",
G_CALLBACK (toggle_shrink), paned->child1);
G_CALLBACK (toggle_shrink), child1);
label = gtk_label_new (label2);
gtk_table_attach_defaults (GTK_TABLE (table), label,
1, 2, 0, 1);
......@@ -98,15 +106,15 @@ create_pane_options (GtkPaned *paned,
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button),
TRUE);
g_signal_connect (check_button, "toggled",
G_CALLBACK (toggle_resize), paned->child2);
G_CALLBACK (toggle_resize), child2);
check_button = gtk_check_button_new_with_mnemonic ("_Shrink");
gtk_table_attach_defaults (GTK_TABLE (table), check_button,
1, 2, 2, 3);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button),
TRUE);
g_signal_connect (check_button, "toggled",
G_CALLBACK (toggle_shrink), paned->child2);
G_CALLBACK (toggle_shrink), child2);
return frame;
}
......
......@@ -144,7 +144,9 @@ gail_paned_get_maximum_value (AtkValue *obj,
/* State is defunct */
return;
maximum_value = GTK_PANED (widget)->max_position;
g_object_get (GTK_PANED (widget),
"max-position", &maximum_value,
NULL);
memset (value, 0, sizeof (GValue));
g_value_init (value, G_TYPE_INT);
g_value_set_int (value, maximum_value);
......@@ -162,7 +164,9 @@ gail_paned_get_minimum_value (AtkValue *obj,
/* State is defunct */
return;
minimum_value = GTK_PANED (widget)->min_position;
g_object_get (GTK_PANED (widget),
"min-position", &minimum_value,
NULL);
memset (value, 0, sizeof (GValue));
g_value_init (value, G_TYPE_INT);
g_value_set_int (value, minimum_value);
......
......@@ -7070,12 +7070,16 @@ create_pane_options (GtkPaned *paned,
const gchar *label1,
const gchar *label2)
{
GtkWidget *child1, *child2;
GtkWidget *frame;
GtkWidget *table;
GtkWidget *label;
GtkWidget *button;
GtkWidget *check_button;
child1 = gtk_paned_get_child1 (paned);
child2 = gtk_paned_get_child2 (paned);
frame = gtk_frame_new (frame_label);
gtk_container_set_border_width (GTK_CONTAINER (frame), 4);
......@@ -7091,8 +7095,8 @@ create_pane_options (GtkPaned *paned,
0, 1, 1, 2);
g_signal_connect (check_button, "toggled",
G_CALLBACK (toggle_resize),
paned->child1);
child1);
check_button = gtk_check_button_new_with_label ("Shrink");
gtk_table_attach_defaults (GTK_TABLE (table), check_button,
0, 1, 2, 3);
......@@ -7100,8 +7104,8 @@ create_pane_options (GtkPaned *paned,
TRUE);
g_signal_connect (check_button, "toggled",
G_CALLBACK (toggle_shrink),
paned->child1);
child1);
label = gtk_label_new (label2);
gtk_table_attach_defaults (GTK_TABLE (table), label,
1, 2, 0, 1);
......@@ -7113,8 +7117,8 @@ create_pane_options (GtkPaned *paned,
TRUE);
g_signal_connect (check_button, "toggled",
G_CALLBACK (toggle_resize),
paned->child2);
child2);
check_button = gtk_check_button_new_with_label ("Shrink");
gtk_table_attach_defaults (GTK_TABLE (table), check_button,
1, 2, 2, 3);
......@@ -7122,7 +7126,7 @@ create_pane_options (GtkPaned *paned,
TRUE);
g_signal_connect (check_button, "toggled",
G_CALLBACK (toggle_shrink),
paned->child2);
child2);
button = gtk_button_new_with_mnemonic ("_Properties");
gtk_table_attach_defaults (GTK_TABLE (table), button,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment