mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-11 13:10:07 +00:00
Use accessor functions to access GtkPaned
This commit is contained in:
parent
28cf61a2ca
commit
92a1382bd6
@ -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,7 +86,7 @@ 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,
|
||||
@ -86,7 +94,7 @@ 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_shrink), paned->child1);
|
||||
G_CALLBACK (toggle_shrink), child1);
|
||||
|
||||
label = gtk_label_new (label2);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), label,
|
||||
@ -98,7 +106,7 @@ 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,
|
||||
@ -106,7 +114,7 @@ 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_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,7 +7095,7 @@ 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,
|
||||
@ -7100,7 +7104,7 @@ 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,
|
||||
@ -7113,7 +7117,7 @@ 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,
|
||||
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user