Compare commits
136 Commits
2.90.5
...
applicatio
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5ae008606d | ||
|
|
b35c2e695a | ||
|
|
8fbccfb1a9 | ||
|
|
66c0673a41 | ||
|
|
aedc5e967f | ||
|
|
c90ca18c2f | ||
|
|
87b0f02403 | ||
|
|
9db9c5f247 | ||
|
|
6fae72c419 | ||
|
|
a2fef51b64 | ||
|
|
461f055da6 | ||
|
|
5828453ae5 | ||
|
|
e1184e362c | ||
|
|
3ea904fa49 | ||
|
|
18a06d6b6a | ||
|
|
3ce68cd5de | ||
|
|
e69979f7b6 | ||
|
|
5f1b5d2406 | ||
|
|
703f7121ae | ||
|
|
1af22acbf7 | ||
|
|
ff27677957 | ||
|
|
9114c4c410 | ||
|
|
bf976cc1e4 | ||
|
|
e6db32de44 | ||
|
|
c17dad9d32 | ||
|
|
cbbffa18f8 | ||
|
|
57d870ac5b | ||
|
|
d5c3fb5231 | ||
|
|
22d4515d9a | ||
|
|
675745e1ca | ||
|
|
65acc3641a | ||
|
|
de9c5f8d3d | ||
|
|
9ddda9c844 | ||
|
|
bcc8494899 | ||
|
|
6fb0e3a09f | ||
|
|
f17a345998 | ||
|
|
c1da2a9204 | ||
|
|
3dfaf72745 | ||
|
|
37a499cea6 | ||
|
|
e6bd773fda | ||
|
|
133502d798 | ||
|
|
ec4c06105d | ||
|
|
6ce52cab3c | ||
|
|
0ddeccefe9 | ||
|
|
e3a4dfe0e1 | ||
|
|
168fbac7f6 | ||
|
|
8c041cde30 | ||
|
|
92a1382bd6 | ||
|
|
28cf61a2ca | ||
|
|
1ca6edf6bf | ||
|
|
978a031b76 | ||
|
|
e2b8112fd8 | ||
|
|
ecce43bcd1 | ||
|
|
4d7ecabaf0 | ||
|
|
a3b039d317 | ||
|
|
59942f91cb | ||
|
|
801708b9e6 | ||
|
|
fbf1de72c4 | ||
|
|
bf9875860b | ||
|
|
511560ba88 | ||
|
|
d4a59142ad | ||
|
|
75686d04a0 | ||
|
|
e2a662b93d | ||
|
|
47e824a5e4 | ||
|
|
ad3b5941ab | ||
|
|
86f0bd5cc9 | ||
|
|
41d2a4d059 | ||
|
|
754dc6491b | ||
|
|
f66ebd8e59 | ||
|
|
e1d182ce5c | ||
|
|
c0228f609c | ||
|
|
997c7b96a8 | ||
|
|
817d1f93cd | ||
|
|
2d9aaf4cf3 | ||
|
|
6fe5203c0a | ||
|
|
324ab58710 | ||
|
|
558a02c730 | ||
|
|
f86456ccb5 | ||
|
|
0991115ada | ||
|
|
58030409d8 | ||
|
|
9b63c322ee | ||
|
|
01bdc682fd | ||
|
|
d4813408b0 | ||
|
|
a8014e6fec | ||
|
|
7f2cc85db9 | ||
|
|
80df961edb | ||
|
|
63d3b197c2 | ||
|
|
4427760bcc | ||
|
|
2de1f3f88c | ||
|
|
63f8313015 | ||
|
|
dfb24fd56e | ||
|
|
3a10216dd0 | ||
|
|
009acc263e | ||
|
|
5fd442eda2 | ||
|
|
56cc11a416 | ||
|
|
ebf6ce274a | ||
|
|
9663801be7 | ||
|
|
56eafbaad8 | ||
|
|
ad45f1ce9d | ||
|
|
06dfffa132 | ||
|
|
94fd7a3502 | ||
|
|
72f515a0f3 | ||
|
|
637c9f16e3 | ||
|
|
3c90ecf27b | ||
|
|
7fdb991b99 | ||
|
|
6736c085b3 | ||
|
|
b71d539fd0 | ||
|
|
c2b079ca05 | ||
|
|
ee1d9df94c | ||
|
|
c0b0b84c6e | ||
|
|
5e815bfee2 | ||
|
|
db584abef3 | ||
|
|
932568d1ed | ||
|
|
4d40f88310 | ||
|
|
0677bb2785 | ||
|
|
a46c1eba64 | ||
|
|
abe267641a | ||
|
|
123717510f | ||
|
|
472753330d | ||
|
|
5ee19bdafe | ||
|
|
a6e0fb92c6 | ||
|
|
3862bf3208 | ||
|
|
fa740ae012 | ||
|
|
8ad3afce95 | ||
|
|
335549b46a | ||
|
|
dba6592601 | ||
|
|
33960b737d | ||
|
|
d562611660 | ||
|
|
c6b6ab0599 | ||
|
|
828f5cbe2e | ||
|
|
04c54efe5c | ||
|
|
a5272c82a6 | ||
|
|
d219adfa5a | ||
|
|
75e75cd305 | ||
|
|
41671d1514 | ||
|
|
9125ccb1cb |
@@ -12,7 +12,7 @@ AC_PREREQ([2.62])
|
||||
|
||||
m4_define([gtk_major_version], [2])
|
||||
m4_define([gtk_minor_version], [90])
|
||||
m4_define([gtk_micro_version], [5])
|
||||
m4_define([gtk_micro_version], [6])
|
||||
m4_define([gtk_interface_age], [0])
|
||||
m4_define([gtk_binary_age],
|
||||
[m4_eval(100 * gtk_minor_version + gtk_micro_version)])
|
||||
@@ -31,7 +31,7 @@ m4_define([gtk_api_version], [3.0])
|
||||
m4_define([gtk_binary_version], [3.0.0])
|
||||
|
||||
# required versions of other packages
|
||||
m4_define([glib_required_version], [2.25.9])
|
||||
m4_define([glib_required_version], [2.25.12])
|
||||
m4_define([pango_required_version], [1.20])
|
||||
m4_define([atk_required_version], [1.29.2])
|
||||
m4_define([cairo_required_version], [1.9.10])
|
||||
|
||||
@@ -229,6 +229,7 @@ static void
|
||||
open_display_cb (GtkWidget *button,
|
||||
ChangeDisplayInfo *info)
|
||||
{
|
||||
GtkWidget *content_area;
|
||||
GtkWidget *dialog;
|
||||
GtkWidget *display_entry;
|
||||
GtkWidget *dialog_label;
|
||||
@@ -248,11 +249,13 @@ open_display_cb (GtkWidget *button,
|
||||
dialog_label =
|
||||
gtk_label_new ("Please enter the name of\nthe new display\n");
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), dialog_label);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), display_entry);
|
||||
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (content_area), dialog_label);
|
||||
gtk_container_add (GTK_CONTAINER (content_area), display_entry);
|
||||
|
||||
gtk_widget_grab_focus (display_entry);
|
||||
gtk_widget_show_all (GTK_BIN (dialog)->child);
|
||||
gtk_widget_show_all (gtk_bin_get_child (GTK_BIN (dialog)));
|
||||
|
||||
while (!result)
|
||||
{
|
||||
@@ -599,6 +602,7 @@ do_changedisplay (GtkWidget *do_widget)
|
||||
|
||||
if (!info)
|
||||
{
|
||||
GtkWidget *content_area;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *frame;
|
||||
|
||||
@@ -618,11 +622,11 @@ do_changedisplay (GtkWidget *do_widget)
|
||||
g_signal_connect (info->window, "destroy",
|
||||
G_CALLBACK (destroy_cb), &info);
|
||||
|
||||
content_area = gtk_dialog_get_content_area (GTK_DIALOG (info->window));
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 8);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (info->window)->vbox), vbox,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (content_area), vbox, TRUE, TRUE, 0);
|
||||
|
||||
frame = create_display_frame (info);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
|
||||
|
||||
@@ -41,13 +41,15 @@ change_color_callback (GtkWidget *button,
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
GtkColorSelection *colorsel;
|
||||
GtkColorSelectionDialog *selection_dialog;
|
||||
gint response;
|
||||
|
||||
dialog = gtk_color_selection_dialog_new ("Changing color");
|
||||
|
||||
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (window));
|
||||
|
||||
colorsel = GTK_COLOR_SELECTION (GTK_COLOR_SELECTION_DIALOG (dialog)->colorsel);
|
||||
|
||||
selection_dialog = GTK_COLOR_SELECTION_DIALOG (dialog);
|
||||
colorsel = GTK_COLOR_SELECTION (gtk_color_selection_dialog_get_color_selection (selection_dialog));
|
||||
|
||||
gtk_color_selection_set_previous_color (colorsel, &color);
|
||||
gtk_color_selection_set_current_color (colorsel, &color);
|
||||
|
||||
@@ -435,7 +435,7 @@ do_combobox (GtkWidget *do_widget)
|
||||
entry = g_object_new (TYPE_MASK_ENTRY, NULL);
|
||||
MASK_ENTRY (entry)->mask = "^([0-9]*|One|Two|2\302\275|Three)$";
|
||||
|
||||
gtk_container_remove (GTK_CONTAINER (combo), GTK_BIN (combo)->child);
|
||||
gtk_container_remove (GTK_CONTAINER (combo), gtk_bin_get_child (GTK_BIN (combo)));
|
||||
gtk_container_add (GTK_CONTAINER (combo), entry);
|
||||
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ static void
|
||||
interactive_dialog_clicked (GtkButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWidget *content_area;
|
||||
GtkWidget *dialog;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *stock;
|
||||
@@ -51,9 +52,11 @@ interactive_dialog_clicked (GtkButton *button,
|
||||
GTK_RESPONSE_CANCEL,
|
||||
NULL);
|
||||
|
||||
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 8);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 8);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (content_area), hbox, FALSE, FALSE, 0);
|
||||
|
||||
stock = gtk_image_new_from_stock (GTK_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), stock, FALSE, FALSE, 0);
|
||||
|
||||
@@ -11,6 +11,7 @@ static GtkWidget *window = NULL;
|
||||
GtkWidget *
|
||||
do_entry_buffer (GtkWidget *do_widget)
|
||||
{
|
||||
GtkWidget *content_area;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *label;
|
||||
GtkWidget *entry;
|
||||
@@ -31,8 +32,10 @@ do_entry_buffer (GtkWidget *do_widget)
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
content_area = gtk_dialog_get_content_area (GTK_DIALOG (window));
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 5);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox), vbox, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (content_area), vbox, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
|
||||
|
||||
label = gtk_label_new (NULL);
|
||||
|
||||
@@ -37,6 +37,7 @@ create_completion_model (void)
|
||||
GtkWidget *
|
||||
do_entry_completion (GtkWidget *do_widget)
|
||||
{
|
||||
GtkWidget *content_area;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *label;
|
||||
GtkWidget *entry;
|
||||
@@ -58,8 +59,10 @@ do_entry_completion (GtkWidget *do_widget)
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
content_area = gtk_dialog_get_content_area (GTK_DIALOG (window));
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 5);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox), vbox, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (content_area), vbox, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
|
||||
|
||||
label = gtk_label_new (NULL);
|
||||
|
||||
@@ -13,6 +13,7 @@ static GtkWidget *window = NULL;
|
||||
GtkWidget *
|
||||
do_expander (GtkWidget *do_widget)
|
||||
{
|
||||
GtkWidget *content_area;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *label;
|
||||
GtkWidget *expander;
|
||||
@@ -32,8 +33,10 @@ do_expander (GtkWidget *do_widget)
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
content_area = gtk_dialog_get_content_area (GTK_DIALOG (window));
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 5);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox), vbox, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (content_area), vbox, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
|
||||
|
||||
label = gtk_label_new ("Expander demo. Click on the triangle for details.");
|
||||
|
||||
@@ -226,12 +226,12 @@ gtk_rotated_bin_realize (GtkWidget *widget)
|
||||
GtkRotatedBin *bin = GTK_ROTATED_BIN (widget);
|
||||
GdkWindowAttr attributes;
|
||||
gint attributes_mask;
|
||||
gint border_width;
|
||||
guint border_width;
|
||||
GtkRequisition child_requisition;
|
||||
|
||||
gtk_widget_set_realized (widget, TRUE);
|
||||
|
||||
border_width = GTK_CONTAINER (widget)->border_width;
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||
|
||||
attributes.x = widget->allocation.x + border_width;
|
||||
attributes.y = widget->allocation.y + border_width;
|
||||
@@ -378,6 +378,7 @@ gtk_rotated_bin_size_request (GtkWidget *widget,
|
||||
GtkRequisition child_requisition;
|
||||
double s, c;
|
||||
double w, h;
|
||||
guint border_width;
|
||||
|
||||
child_requisition.width = 0;
|
||||
child_requisition.height = 0;
|
||||
@@ -390,8 +391,9 @@ gtk_rotated_bin_size_request (GtkWidget *widget,
|
||||
w = c * child_requisition.width + s * child_requisition.height;
|
||||
h = s * child_requisition.width + c * child_requisition.height;
|
||||
|
||||
requisition->width = GTK_CONTAINER (widget)->border_width * 2 + w;
|
||||
requisition->height = GTK_CONTAINER (widget)->border_width * 2 + h;
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||
requisition->width = border_width * 2 + w;
|
||||
requisition->height = border_width * 2 + h;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -399,13 +401,13 @@ gtk_rotated_bin_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation)
|
||||
{
|
||||
GtkRotatedBin *bin = GTK_ROTATED_BIN (widget);
|
||||
gint border_width;
|
||||
guint border_width;
|
||||
gint w, h;
|
||||
gdouble s, c;
|
||||
|
||||
widget->allocation = *allocation;
|
||||
|
||||
border_width = GTK_CONTAINER (widget)->border_width;
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||
|
||||
w = allocation->width - border_width * 2;
|
||||
h = allocation->height - border_width * 2;
|
||||
|
||||
@@ -164,12 +164,12 @@ gtk_mirror_bin_realize (GtkWidget *widget)
|
||||
GtkMirrorBin *bin = GTK_MIRROR_BIN (widget);
|
||||
GdkWindowAttr attributes;
|
||||
gint attributes_mask;
|
||||
gint border_width;
|
||||
guint border_width;
|
||||
GtkRequisition child_requisition;
|
||||
|
||||
gtk_widget_set_realized (widget, TRUE);
|
||||
|
||||
border_width = GTK_CONTAINER (widget)->border_width;
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||
|
||||
attributes.x = widget->allocation.x + border_width;
|
||||
attributes.y = widget->allocation.y + border_width;
|
||||
@@ -302,6 +302,7 @@ gtk_mirror_bin_size_request (GtkWidget *widget,
|
||||
{
|
||||
GtkMirrorBin *bin = GTK_MIRROR_BIN (widget);
|
||||
GtkRequisition child_requisition;
|
||||
guint border_width;
|
||||
|
||||
child_requisition.width = 0;
|
||||
child_requisition.height = 0;
|
||||
@@ -309,8 +310,9 @@ gtk_mirror_bin_size_request (GtkWidget *widget,
|
||||
if (bin->child && gtk_widget_get_visible (bin->child))
|
||||
gtk_widget_size_request (bin->child, &child_requisition);
|
||||
|
||||
requisition->width = GTK_CONTAINER (widget)->border_width * 2 + child_requisition.width + 10;
|
||||
requisition->height = GTK_CONTAINER (widget)->border_width * 2 + child_requisition.height * 2 + 10;
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||
requisition->width = border_width * 2 + child_requisition.width + 10;
|
||||
requisition->height = border_width * 2 + child_requisition.height * 2 + 10;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -318,11 +320,12 @@ gtk_mirror_bin_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation)
|
||||
{
|
||||
GtkMirrorBin *bin = GTK_MIRROR_BIN (widget);
|
||||
gint border_width;
|
||||
gint w, h;
|
||||
guint border_width;
|
||||
|
||||
widget->allocation = *allocation;
|
||||
|
||||
border_width = GTK_CONTAINER (widget)->border_width;
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||
|
||||
w = allocation->width - border_width * 2;
|
||||
h = allocation->height - border_width * 2;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -241,6 +241,7 @@ entry_populate_popup (GtkEntry *entry,
|
||||
GtkWidget *
|
||||
do_search_entry (GtkWidget *do_widget)
|
||||
{
|
||||
GtkWidget *content_area;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *label;
|
||||
@@ -263,8 +264,10 @@ do_search_entry (GtkWidget *do_widget)
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (search_entry_destroyed), &window);
|
||||
|
||||
content_area = gtk_dialog_get_content_area (GTK_DIALOG (window));
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 5);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox), vbox, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (content_area), vbox, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
|
||||
|
||||
label = gtk_label_new (NULL);
|
||||
|
||||
@@ -82,6 +82,7 @@ toggle_grouping (GtkToggleButton *check_button,
|
||||
GtkWidget *
|
||||
do_sizegroup (GtkWidget *do_widget)
|
||||
{
|
||||
GtkWidget *content_area;
|
||||
GtkWidget *table;
|
||||
GtkWidget *frame;
|
||||
GtkWidget *vbox;
|
||||
@@ -115,8 +116,10 @@ do_sizegroup (GtkWidget *do_widget)
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
content_area = gtk_dialog_get_content_area (GTK_DIALOG (window));
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 5);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox), vbox, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (content_area), vbox, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
|
||||
|
||||
size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
||||
|
||||
@@ -27,6 +27,7 @@ on_stop_clicked (GtkButton *button, gpointer user_data)
|
||||
GtkWidget *
|
||||
do_spinner (GtkWidget *do_widget)
|
||||
{
|
||||
GtkWidget *content_area;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *button;
|
||||
@@ -47,8 +48,10 @@ do_spinner (GtkWidget *do_widget)
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
content_area = gtk_dialog_get_content_area (GTK_DIALOG (window));
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 5);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox), vbox, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (content_area), vbox, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
|
||||
|
||||
/* Sensitive */
|
||||
|
||||
@@ -78,7 +78,6 @@ IGNORE_HFILES= \
|
||||
gtktexttypes.h \
|
||||
gtktextutil.h \
|
||||
gtkthemes.h \
|
||||
gtktoggleactionprivate.h \
|
||||
gtktrayicon.h \
|
||||
gtktreedatalist.h \
|
||||
gtktreeprivate.h \
|
||||
|
||||
1
docs/reference/gtk/tmpl/.gitignore
vendored
1
docs/reference/gtk/tmpl/.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
gtkactiongroup.sgml
|
||||
gtkbbox.sgml
|
||||
gtkbox.sgml
|
||||
gtkbuilder.sgml
|
||||
|
||||
@@ -1,401 +0,0 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
GtkActionGroup
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
A group of actions
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
Actions are organised into groups. An action group is essentially a
|
||||
map from names to #GtkAction objects.
|
||||
</para>
|
||||
<para>
|
||||
All actions that would make sense to use in a particular context
|
||||
should be in a single group. Multiple action groups may be used for a
|
||||
particular user interface. In fact, it is expected that most nontrivial
|
||||
applications will make use of multiple groups. For example, in an application
|
||||
that can edit multiple documents, one group holding global actions
|
||||
(e.g. quit, about, new), and one group per document holding actions that
|
||||
act on that document (eg. save, cut/copy/paste, etc). Each window's menus
|
||||
would be constructed from a combination of two action groups.
|
||||
</para>
|
||||
<para id="Action-Accel">
|
||||
Accelerators are handled by the GTK+ accelerator map. All actions are assigned an
|
||||
accelerator path (which normally has the form
|
||||
<literal><Actions>/<replaceable>group-name</replaceable>/<replaceable>action-name</replaceable></literal>)
|
||||
and a shortcut is associated with this accelerator path. All menuitems and
|
||||
toolitems take on this accelerator path. The GTK+ accelerator map code makes
|
||||
sure that the correct shortcut is displayed next to the menu item.
|
||||
</para>
|
||||
|
||||
<refsect2 id="GtkActionGroup-BUILDER-UI">
|
||||
<title>GtkActionGroup as GtkBuildable</title>
|
||||
<para>
|
||||
The GtkActionGroup implementation of the GtkBuildable interface accepts
|
||||
GtkAction objects as <child> elements in UI definitions.
|
||||
</para>
|
||||
<para>
|
||||
Note that it is probably more common to define actions and action groups
|
||||
in the code, since they are directly related to what the code can do.
|
||||
</para>
|
||||
<para>
|
||||
The GtkActionGroup implementation of the GtkBuildable interface supports a
|
||||
custom <accelerator> element, which has attributes named key and
|
||||
modifiers and allows to specify accelerators. This is similar to the
|
||||
<accelerator> element of GtkWidget, the main difference is that
|
||||
it doesn't allow you to specify a signal.
|
||||
</para>
|
||||
<example>
|
||||
<title>A <structname>GtkDialog</structname> UI definition fragment.</title>
|
||||
<programlisting><![CDATA[
|
||||
<object class="GtkActionGroup" id="actiongroup">
|
||||
<child>
|
||||
<object class="GtkAction" id="About">
|
||||
<property name="name">About</property>
|
||||
<property name="stock_id">gtk-about</property>
|
||||
<signal handler="about_activate" name="activate"/>
|
||||
</object>
|
||||
<accelerator key="F1" modifiers="GDK_CONTROL_MASK | GDK_SHIFT_MASK"/>
|
||||
</child>
|
||||
</object>
|
||||
]]></programlisting>
|
||||
</example>
|
||||
</refsect2>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION Stability_Level ##### -->
|
||||
|
||||
|
||||
<!-- ##### SECTION Image ##### -->
|
||||
|
||||
|
||||
<!-- ##### STRUCT GtkActionGroup ##### -->
|
||||
<para>
|
||||
The <structname>GtkActionGroup</structname> struct contains only private
|
||||
members and should not be accessed directly.
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### SIGNAL GtkActionGroup::connect-proxy ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@actiongroup: the object which received the signal.
|
||||
@arg1:
|
||||
@widget:
|
||||
|
||||
<!-- ##### SIGNAL GtkActionGroup::disconnect-proxy ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@actiongroup: the object which received the signal.
|
||||
@arg1:
|
||||
@widget:
|
||||
|
||||
<!-- ##### SIGNAL GtkActionGroup::post-activate ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@actiongroup: the object which received the signal.
|
||||
@arg1:
|
||||
|
||||
<!-- ##### SIGNAL GtkActionGroup::pre-activate ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@actiongroup: the object which received the signal.
|
||||
@arg1:
|
||||
|
||||
<!-- ##### ARG GtkActionGroup:name ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkActionGroup:sensitive ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkActionGroup:visible ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### FUNCTION gtk_action_group_new ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@name:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_action_group_get_name ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@action_group:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_action_group_get_sensitive ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@action_group:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_action_group_set_sensitive ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@action_group:
|
||||
@sensitive:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_action_group_get_visible ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@action_group:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_action_group_set_visible ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@action_group:
|
||||
@visible:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_action_group_get_action ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@action_group:
|
||||
@action_name:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_action_group_list_actions ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@action_group:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_action_group_add_action ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@action_group:
|
||||
@action:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_action_group_add_action_with_accel ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@action_group:
|
||||
@action:
|
||||
@accelerator:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_action_group_remove_action ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@action_group:
|
||||
@action:
|
||||
|
||||
|
||||
<!-- ##### STRUCT GtkActionEntry ##### -->
|
||||
<para>
|
||||
<structname>GtkActionEntry</structname> structs are used with
|
||||
gtk_action_group_add_actions() to construct actions.
|
||||
</para>
|
||||
|
||||
@name: The name of the action.
|
||||
@stock_id: The stock id for the action, or the name of an icon from the icon
|
||||
theme.
|
||||
@label: The label for the action. This field should typically be marked for
|
||||
translation, see gtk_action_group_set_translation_domain(). If @label
|
||||
is %NULL, the label of the stock item with id @stock_id is used.
|
||||
@accelerator: The accelerator for the action, in the format understood by
|
||||
gtk_accelerator_parse().
|
||||
@tooltip: The tooltip for the action. This field should typically be marked
|
||||
for translation, see gtk_action_group_set_translation_domain().
|
||||
@callback: The function to call when the action is activated.
|
||||
|
||||
<!-- ##### FUNCTION gtk_action_group_add_actions ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@action_group:
|
||||
@entries:
|
||||
@n_entries:
|
||||
@user_data:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_action_group_add_actions_full ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@action_group:
|
||||
@entries:
|
||||
@n_entries:
|
||||
@user_data:
|
||||
@destroy:
|
||||
|
||||
|
||||
<!-- ##### STRUCT GtkToggleActionEntry ##### -->
|
||||
<para>
|
||||
<structname>GtkToggleActionEntry</structname> structs are used with
|
||||
gtk_action_group_add_toggle_actions() to construct toggle actions.
|
||||
</para>
|
||||
|
||||
@name: The name of the action.
|
||||
@stock_id: The stock id for the action, or the name of an icon from the icon
|
||||
theme.
|
||||
@label: The label for the action. This field should typically be marked for
|
||||
translation, see gtk_action_group_set_translation_domain().
|
||||
@accelerator: The accelerator for the action, in the format understood by
|
||||
gtk_accelerator_parse().
|
||||
@tooltip: The tooltip for the action. This field should typically be marked
|
||||
for translation, see gtk_action_group_set_translation_domain().
|
||||
@callback: The function to call when the action is activated.
|
||||
@is_active: The initial state of the toggle action.
|
||||
|
||||
<!-- ##### FUNCTION gtk_action_group_add_toggle_actions ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@action_group:
|
||||
@entries:
|
||||
@n_entries:
|
||||
@user_data:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_action_group_add_toggle_actions_full ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@action_group:
|
||||
@entries:
|
||||
@n_entries:
|
||||
@user_data:
|
||||
@destroy:
|
||||
|
||||
|
||||
<!-- ##### STRUCT GtkRadioActionEntry ##### -->
|
||||
<para>
|
||||
<structname>GtkRadioActionEntry</structname> structs are used with
|
||||
gtk_action_group_add_radio_actions() to construct groups of radio actions.
|
||||
</para>
|
||||
|
||||
@name: The name of the action.
|
||||
@stock_id: The stock id for the action, or the name of an icon from the icon
|
||||
theme.
|
||||
@label: The label for the action. This field should typically be marked for
|
||||
translation, see gtk_action_group_set_translation_domain().
|
||||
@accelerator: The accelerator for the action, in the format understood by
|
||||
gtk_accelerator_parse().
|
||||
@tooltip: The tooltip for the action. This field should typically be marked for
|
||||
translation, see gtk_action_group_set_translation_domain().
|
||||
@value: The value to set on the radio action. See gtk_radio_action_get_current_value().
|
||||
|
||||
<!-- ##### FUNCTION gtk_action_group_add_radio_actions ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@action_group:
|
||||
@entries:
|
||||
@n_entries:
|
||||
@value:
|
||||
@on_change:
|
||||
@user_data:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_action_group_add_radio_actions_full ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@action_group:
|
||||
@entries:
|
||||
@n_entries:
|
||||
@value:
|
||||
@on_change:
|
||||
@user_data:
|
||||
@destroy:
|
||||
|
||||
|
||||
<!-- ##### USER_FUNCTION GtkTranslateFunc ##### -->
|
||||
<para>
|
||||
The function used to translate messages in e.g. #GtkIconFactory
|
||||
and #GtkActionGroup.
|
||||
</para>
|
||||
|
||||
@path: The id of the message. In #GtkItemFactory this will be a path
|
||||
from a #GtkItemFactoryEntry, in #GtkActionGroup, it will be a label
|
||||
or tooltip from a #GtkActionEntry.
|
||||
@func_data: user data passed in when registering the function
|
||||
@Returns: the translated message
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_action_group_set_translate_func ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@action_group:
|
||||
@func:
|
||||
@data:
|
||||
@notify:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_action_group_set_translation_domain ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@action_group:
|
||||
@domain:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_action_group_translate_string ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@action_group:
|
||||
@string:
|
||||
@Returns:
|
||||
|
||||
|
||||
@@ -48,11 +48,6 @@ only be accessed using the functions below.
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### ARG GtkFontSelection:font ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkFontSelection:font-name ##### -->
|
||||
<para>
|
||||
|
||||
|
||||
@@ -279,13 +279,15 @@ create_combo_box_entry (void)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkWidget *align;
|
||||
GtkWidget *child;
|
||||
|
||||
gtk_rc_parse_string ("style \"combo-box-entry-style\" {\n"
|
||||
" GtkComboBox::appears-as-list = 1\n"
|
||||
"}\n"
|
||||
"widget_class \"GtkComboBoxEntry\" style \"combo-box-entry-style\"\n" );
|
||||
widget = gtk_combo_box_entry_new_text ();
|
||||
gtk_entry_set_text (GTK_ENTRY (GTK_BIN (widget)->child), "Combo Box Entry");
|
||||
child = gtk_bin_get_child (GTK_BIN (widget));
|
||||
gtk_entry_set_text (GTK_ENTRY (child), "Combo Box Entry");
|
||||
align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
|
||||
gtk_container_add (GTK_CONTAINER (align), widget);
|
||||
|
||||
@@ -612,10 +614,12 @@ create_colorsel (void)
|
||||
WidgetInfo *info;
|
||||
GtkWidget *widget;
|
||||
GtkColorSelection *colorsel;
|
||||
GtkColorSelectionDialog *selection_dialog;
|
||||
GdkColor color;
|
||||
|
||||
widget = gtk_color_selection_dialog_new ("Color Selection Dialog");
|
||||
colorsel = GTK_COLOR_SELECTION (GTK_COLOR_SELECTION_DIALOG (widget)->colorsel);
|
||||
selection_dialog = GTK_COLOR_SELECTION_DIALOG (widget);
|
||||
colorsel = GTK_COLOR_SELECTION (gtk_color_selection_dialog_get_color_selection (selection_dialog));
|
||||
|
||||
color.red = 0x7979;
|
||||
color.green = 0xdbdb;
|
||||
@@ -995,7 +999,7 @@ create_volume_button (void)
|
||||
button = gtk_volume_button_new ();
|
||||
gtk_scale_button_set_value (GTK_SCALE_BUTTON (button), 33);
|
||||
/* Hack: get the private dock */
|
||||
widget = GTK_SCALE_BUTTON (button)->plus_button->parent->parent->parent;
|
||||
widget = gtk_scale_button_get_plus_button (GTK_SCALE_BUTTON (button))->parent->parent->parent;
|
||||
gtk_widget_show_all (widget);
|
||||
return new_widget_info ("volumebutton", widget, ASIS);
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ static gboolean area_event( GtkWidget *widget,
|
||||
gint handled = FALSE;
|
||||
gint response;
|
||||
GtkColorSelection *colorsel;
|
||||
GtkColorSelectionDialog *selection_dialog;
|
||||
|
||||
/* Check if we've received a button pressed event */
|
||||
|
||||
@@ -39,7 +40,8 @@ static gboolean area_event( GtkWidget *widget,
|
||||
colorseldlg = gtk_color_selection_dialog_new ("Select background color");
|
||||
|
||||
/* Get the ColorSelection widget */
|
||||
colorsel = GTK_COLOR_SELECTION (GTK_COLOR_SELECTION_DIALOG (colorseldlg)->colorsel);
|
||||
selection_dialog = GTK_COLOR_SELECTION_DIALOG (colorseldlg);
|
||||
colorsel = GTK_COLOR_SELECTION (gtk_color_selection_dialog_get_colorsel (selection_dialog));
|
||||
|
||||
gtk_color_selection_set_previous_color (colorsel, &color);
|
||||
gtk_color_selection_set_current_color (colorsel, &color);
|
||||
|
||||
@@ -392,7 +392,6 @@ gtk_private_h_sources = \
|
||||
gtktexttypes.h \
|
||||
gtktextutil.h \
|
||||
gtkthemes.h \
|
||||
gtktoggleactionprivate.h\
|
||||
gtktoolpaletteprivate.h \
|
||||
gtktreedatalist.h \
|
||||
gtktreeprivate.h \
|
||||
|
||||
@@ -265,6 +265,7 @@ gtk_application_new
|
||||
gtk_application_set_action_group
|
||||
gtk_application_create_window
|
||||
gtk_application_get_window
|
||||
gtk_application_get_windows
|
||||
gtk_application_add_window
|
||||
gtk_application_run
|
||||
gtk_application_quit
|
||||
|
||||
@@ -197,9 +197,9 @@ gtk_accel_map_add_entry (const gchar *accel_path,
|
||||
|
||||
/**
|
||||
* gtk_accel_map_lookup_entry:
|
||||
* @accel_path: a valid accelerator path
|
||||
* @key: the accelerator key to be filled in (optional)
|
||||
* @returns: %TRUE if @accel_path is known, %FALSE otherwise
|
||||
* @accel_path: a valid accelerator path
|
||||
* @key: (allow-none) (out): the accelerator key to be filled in (optional)
|
||||
* @returns: %TRUE if @accel_path is known, %FALSE otherwise
|
||||
*
|
||||
* Looks up the accelerator entry for @accel_path and fills in @key.
|
||||
*/
|
||||
@@ -979,7 +979,7 @@ gtk_accel_map_init (GtkAccelMap *accel_map)
|
||||
* map via the ::changed signal; it isn't a parameter to the
|
||||
* other accelerator map functions.
|
||||
*
|
||||
* Return value: the global #GtkAccelMap object
|
||||
* Return value: (transfer none): the global #GtkAccelMap object
|
||||
*
|
||||
* Since: 2.4
|
||||
**/
|
||||
|
||||
@@ -30,20 +30,34 @@
|
||||
* @Title: GtkAccessible
|
||||
*/
|
||||
|
||||
/*
|
||||
* GtkAccessiblePriv:
|
||||
* @widget: The GtkWidget whose properties and features are exported via this
|
||||
* accessible instance
|
||||
*/
|
||||
struct _GtkAccessiblePriv
|
||||
{
|
||||
GtkWidget *widget;
|
||||
};
|
||||
|
||||
static void gtk_accessible_real_connect_widget_destroyed (GtkAccessible *accessible);
|
||||
|
||||
G_DEFINE_TYPE (GtkAccessible, gtk_accessible, ATK_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
gtk_accessible_init (GtkAccessible *object)
|
||||
gtk_accessible_init (GtkAccessible *accesible)
|
||||
{
|
||||
accesible->priv = G_TYPE_INSTANCE_GET_PRIVATE (accesible,
|
||||
GTK_TYPE_ACCESSIBLE,
|
||||
GtkAccessiblePriv);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_accessible_class_init (GtkAccessibleClass *klass)
|
||||
{
|
||||
klass->connect_widget_destroyed = gtk_accessible_real_connect_widget_destroyed;
|
||||
|
||||
g_type_class_add_private (klass, sizeof (GtkAccessiblePriv));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,7 +75,7 @@ gtk_accessible_set_widget (GtkAccessible *accessible,
|
||||
{
|
||||
g_return_if_fail (GTK_IS_ACCESSIBLE (accessible));
|
||||
|
||||
accessible->widget = widget;
|
||||
accessible->priv->widget = widget;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -81,7 +95,7 @@ gtk_accessible_get_widget (GtkAccessible *accessible)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_ACCESSIBLE (accessible), NULL);
|
||||
|
||||
return accessible->widget;
|
||||
return accessible->priv->widget;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -107,11 +121,13 @@ gtk_accessible_connect_widget_destroyed (GtkAccessible *accessible)
|
||||
static void
|
||||
gtk_accessible_real_connect_widget_destroyed (GtkAccessible *accessible)
|
||||
{
|
||||
if (accessible->widget)
|
||||
GtkAccessiblePriv *priv = accessible->priv;
|
||||
|
||||
if (priv->widget)
|
||||
{
|
||||
g_signal_connect (accessible->widget,
|
||||
g_signal_connect (priv->widget,
|
||||
"destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed),
|
||||
&accessible->widget);
|
||||
&priv->widget);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ G_BEGIN_DECLS
|
||||
#define GTK_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ACCESSIBLE, GtkAccessibleClass))
|
||||
|
||||
typedef struct _GtkAccessible GtkAccessible;
|
||||
typedef struct _GtkAccessiblePriv GtkAccessiblePriv;
|
||||
typedef struct _GtkAccessibleClass GtkAccessibleClass;
|
||||
|
||||
/*
|
||||
@@ -46,11 +47,8 @@ struct _GtkAccessible
|
||||
{
|
||||
AtkObject parent;
|
||||
|
||||
/*
|
||||
* The GtkWidget whose properties and features are exported via this
|
||||
* accessible instance.
|
||||
*/
|
||||
GtkWidget *GSEAL (widget);
|
||||
/*< private >*/
|
||||
GtkAccessiblePriv *priv;
|
||||
};
|
||||
|
||||
struct _GtkAccessibleClass
|
||||
|
||||
@@ -94,8 +94,6 @@
|
||||
#include "gtkactivatable.h"
|
||||
|
||||
|
||||
#define GTK_ACTION_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_ACTION, GtkActionPrivate))
|
||||
|
||||
struct _GtkActionPrivate
|
||||
{
|
||||
const gchar *name; /* interned */
|
||||
@@ -441,7 +439,9 @@ gtk_action_class_init (GtkActionClass *klass)
|
||||
static void
|
||||
gtk_action_init (GtkAction *action)
|
||||
{
|
||||
action->private_data = GTK_ACTION_GET_PRIVATE (action);
|
||||
action->private_data = G_TYPE_INSTANCE_GET_PRIVATE (action,
|
||||
GTK_TYPE_ACTION,
|
||||
GtkActionPrivate);
|
||||
|
||||
action->private_data->name = NULL;
|
||||
action->private_data->label = NULL;
|
||||
|
||||
@@ -55,8 +55,7 @@ struct _GtkAction
|
||||
GObject object;
|
||||
|
||||
/*< private >*/
|
||||
|
||||
GtkActionPrivate *GSEAL (private_data);
|
||||
GtkActionPrivate *private_data;
|
||||
};
|
||||
|
||||
struct _GtkActionClass
|
||||
|
||||
@@ -28,6 +28,66 @@
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:gtkactiongroup
|
||||
* @Short_description: A group of actions
|
||||
* @Title: GtkActionGroup
|
||||
*
|
||||
* Actions are organised into groups. An action group is essentially a
|
||||
* map from names to #GtkAction objects.
|
||||
*
|
||||
* All actions that would make sense to use in a particular context
|
||||
* should be in a single group. Multiple action groups may be used for a
|
||||
* particular user interface. In fact, it is expected that most nontrivial
|
||||
* applications will make use of multiple groups. For example, in an
|
||||
* application that can edit multiple documents, one group holding global
|
||||
* actions (e.g. quit, about, new), and one group per document holding
|
||||
* actions that act on that document (eg. save, cut/copy/paste, etc). Each
|
||||
* window's menus would be constructed from a combination of two action
|
||||
* groups.
|
||||
* </para>
|
||||
* <para id="Action-Accel">
|
||||
* Accelerators are handled by the GTK+ accelerator map. All actions are
|
||||
* assigned an accelerator path (which normally has the form
|
||||
* <literal><Actions>/group-name/action-name</literal>)
|
||||
* and a shortcut is associated with this accelerator path. All menuitems
|
||||
* and toolitems take on this accelerator path. The GTK+ accelerator map
|
||||
* code makes sure that the correct shortcut is displayed next to the menu
|
||||
* item.
|
||||
*
|
||||
* <refsect2 id="GtkActionGroup-BUILDER-UI">
|
||||
* <title>GtkActionGroup as GtkBuildable</title>
|
||||
* <para>
|
||||
* The #GtkActionGroup implementation of the #GtkBuildable interface accepts
|
||||
* #GtkAction objects as <child> elements in UI definitions.
|
||||
*
|
||||
* Note that it is probably more common to define actions and action groups
|
||||
* in the code, since they are directly related to what the code can do.
|
||||
*
|
||||
* The GtkActionGroup implementation of the GtkBuildable interface supports
|
||||
* a custom <accelerator> element, which has attributes named key and
|
||||
* modifiers and allows to specify accelerators. This is similar to the
|
||||
* <accelerator> element of #GtkWidget, the main difference is that
|
||||
* it doesn't allow you to specify a signal.
|
||||
* </para>
|
||||
* <example>
|
||||
* <title>A #GtkDialog UI definition fragment.</title>
|
||||
* <programlisting><![CDATA[
|
||||
* <object class="GtkActionGroup" id="actiongroup">
|
||||
* <child>
|
||||
* <object class="GtkAction" id="About">
|
||||
* <property name="name">About</property>
|
||||
* <property name="stock_id">gtk-about</property>
|
||||
* <signal handler="about_activate" name="activate"/>
|
||||
* </object>
|
||||
* <accelerator key="F1" modifiers="GDK_CONTROL_MASK | GDK_SHIFT_MASK"/>
|
||||
* </child>
|
||||
* </object>
|
||||
* ]]></programlisting>
|
||||
* </example>
|
||||
* </refsect2>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <string.h>
|
||||
|
||||
@@ -44,7 +104,6 @@
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkintl.h"
|
||||
|
||||
#define GTK_ACTION_GROUP_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_ACTION_GROUP, GtkActionGroupPrivate))
|
||||
|
||||
struct _GtkActionGroupPrivate
|
||||
{
|
||||
@@ -290,11 +349,14 @@ remove_action (GtkAction *action)
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_action_group_init (GtkActionGroup *self)
|
||||
gtk_action_group_init (GtkActionGroup *action_group)
|
||||
{
|
||||
GtkActionGroupPrivate *private;
|
||||
|
||||
private = GTK_ACTION_GROUP_GET_PRIVATE (self);
|
||||
action_group->priv = G_TYPE_INSTANCE_GET_PRIVATE (action_group,
|
||||
GTK_TYPE_ACTION_GROUP,
|
||||
GtkActionGroupPrivate);
|
||||
private = action_group->priv;
|
||||
|
||||
private->name = NULL;
|
||||
private->sensitive = TRUE;
|
||||
@@ -332,7 +394,7 @@ gtk_action_group_buildable_set_name (GtkBuildable *buildable,
|
||||
const gchar *name)
|
||||
{
|
||||
GtkActionGroup *self = GTK_ACTION_GROUP (buildable);
|
||||
GtkActionGroupPrivate *private = GTK_ACTION_GROUP_GET_PRIVATE (self);
|
||||
GtkActionGroupPrivate *private = self->priv;
|
||||
|
||||
private->name = g_strdup (name);
|
||||
}
|
||||
@@ -341,7 +403,8 @@ static const gchar *
|
||||
gtk_action_group_buildable_get_name (GtkBuildable *buildable)
|
||||
{
|
||||
GtkActionGroup *self = GTK_ACTION_GROUP (buildable);
|
||||
GtkActionGroupPrivate *private = GTK_ACTION_GROUP_GET_PRIVATE (self);
|
||||
GtkActionGroupPrivate *private = self->priv;
|
||||
|
||||
return private->name;
|
||||
}
|
||||
|
||||
@@ -435,7 +498,7 @@ gtk_action_group_buildable_custom_tag_end (GtkBuildable *buildable,
|
||||
|
||||
data = (AcceleratorParserData*)user_data;
|
||||
action_group = GTK_ACTION_GROUP (buildable);
|
||||
private = GTK_ACTION_GROUP_GET_PRIVATE (action_group);
|
||||
private = action_group->priv;
|
||||
action = GTK_ACTION (child);
|
||||
|
||||
accel_path = g_strconcat ("<Actions>/",
|
||||
@@ -473,7 +536,7 @@ gtk_action_group_new (const gchar *name)
|
||||
GtkActionGroupPrivate *private;
|
||||
|
||||
self = g_object_new (GTK_TYPE_ACTION_GROUP, NULL);
|
||||
private = GTK_ACTION_GROUP_GET_PRIVATE (self);
|
||||
private = self->priv;
|
||||
private->name = g_strdup (name);
|
||||
|
||||
return self;
|
||||
@@ -486,7 +549,7 @@ gtk_action_group_finalize (GObject *object)
|
||||
GtkActionGroupPrivate *private;
|
||||
|
||||
self = GTK_ACTION_GROUP (object);
|
||||
private = GTK_ACTION_GROUP_GET_PRIVATE (self);
|
||||
private = self->priv;
|
||||
|
||||
g_free (private->name);
|
||||
private->name = NULL;
|
||||
@@ -511,7 +574,7 @@ gtk_action_group_set_property (GObject *object,
|
||||
gchar *tmp;
|
||||
|
||||
self = GTK_ACTION_GROUP (object);
|
||||
private = GTK_ACTION_GROUP_GET_PRIVATE (self);
|
||||
private = self->priv;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
@@ -542,7 +605,7 @@ gtk_action_group_get_property (GObject *object,
|
||||
GtkActionGroupPrivate *private;
|
||||
|
||||
self = GTK_ACTION_GROUP (object);
|
||||
private = GTK_ACTION_GROUP_GET_PRIVATE (self);
|
||||
private = self->priv;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
@@ -567,7 +630,7 @@ gtk_action_group_real_get_action (GtkActionGroup *self,
|
||||
{
|
||||
GtkActionGroupPrivate *private;
|
||||
|
||||
private = GTK_ACTION_GROUP_GET_PRIVATE (self);
|
||||
private = self->priv;
|
||||
|
||||
return g_hash_table_lookup (private->actions, action_name);
|
||||
}
|
||||
@@ -589,7 +652,7 @@ gtk_action_group_get_name (GtkActionGroup *action_group)
|
||||
|
||||
g_return_val_if_fail (GTK_IS_ACTION_GROUP (action_group), NULL);
|
||||
|
||||
private = GTK_ACTION_GROUP_GET_PRIVATE (action_group);
|
||||
private = action_group->priv;
|
||||
|
||||
return private->name;
|
||||
}
|
||||
@@ -614,7 +677,7 @@ gtk_action_group_get_sensitive (GtkActionGroup *action_group)
|
||||
|
||||
g_return_val_if_fail (GTK_IS_ACTION_GROUP (action_group), FALSE);
|
||||
|
||||
private = GTK_ACTION_GROUP_GET_PRIVATE (action_group);
|
||||
private = action_group->priv;
|
||||
|
||||
return private->sensitive;
|
||||
}
|
||||
@@ -646,7 +709,7 @@ gtk_action_group_set_sensitive (GtkActionGroup *action_group,
|
||||
|
||||
g_return_if_fail (GTK_IS_ACTION_GROUP (action_group));
|
||||
|
||||
private = GTK_ACTION_GROUP_GET_PRIVATE (action_group);
|
||||
private = action_group->priv;
|
||||
sensitive = sensitive != FALSE;
|
||||
|
||||
if (private->sensitive != sensitive)
|
||||
@@ -679,7 +742,7 @@ gtk_action_group_get_visible (GtkActionGroup *action_group)
|
||||
|
||||
g_return_val_if_fail (GTK_IS_ACTION_GROUP (action_group), FALSE);
|
||||
|
||||
private = GTK_ACTION_GROUP_GET_PRIVATE (action_group);
|
||||
private = action_group->priv;
|
||||
|
||||
return private->visible;
|
||||
}
|
||||
@@ -710,7 +773,7 @@ gtk_action_group_set_visible (GtkActionGroup *action_group,
|
||||
|
||||
g_return_if_fail (GTK_IS_ACTION_GROUP (action_group));
|
||||
|
||||
private = GTK_ACTION_GROUP_GET_PRIVATE (action_group);
|
||||
private = action_group->priv;
|
||||
visible = visible != FALSE;
|
||||
|
||||
if (private->visible != visible)
|
||||
@@ -753,7 +816,7 @@ check_unique_action (GtkActionGroup *action_group,
|
||||
{
|
||||
GtkActionGroupPrivate *private;
|
||||
|
||||
private = GTK_ACTION_GROUP_GET_PRIVATE (action_group);
|
||||
private = action_group->priv;
|
||||
|
||||
g_warning ("Refusing to add non-unique action '%s' to action group '%s'",
|
||||
action_name,
|
||||
@@ -794,7 +857,7 @@ gtk_action_group_add_action (GtkActionGroup *action_group,
|
||||
if (!check_unique_action (action_group, name))
|
||||
return;
|
||||
|
||||
private = GTK_ACTION_GROUP_GET_PRIVATE (action_group);
|
||||
private = action_group->priv;
|
||||
|
||||
g_hash_table_insert (private->actions,
|
||||
(gpointer) name,
|
||||
@@ -835,7 +898,7 @@ gtk_action_group_add_action_with_accel (GtkActionGroup *action_group,
|
||||
if (!check_unique_action (action_group, name))
|
||||
return;
|
||||
|
||||
private = GTK_ACTION_GROUP_GET_PRIVATE (action_group);
|
||||
private = action_group->priv;
|
||||
accel_path = g_strconcat ("<Actions>/",
|
||||
private->name, "/", name, NULL);
|
||||
|
||||
@@ -898,7 +961,7 @@ gtk_action_group_remove_action (GtkActionGroup *action_group,
|
||||
name = gtk_action_get_name (action);
|
||||
g_return_if_fail (name != NULL);
|
||||
|
||||
private = GTK_ACTION_GROUP_GET_PRIVATE (action_group);
|
||||
private = action_group->priv;
|
||||
|
||||
g_hash_table_remove (private->actions, name);
|
||||
}
|
||||
@@ -931,7 +994,7 @@ gtk_action_group_list_actions (GtkActionGroup *action_group)
|
||||
|
||||
g_return_val_if_fail (GTK_IS_ACTION_GROUP (action_group), NULL);
|
||||
|
||||
private = GTK_ACTION_GROUP_GET_PRIVATE (action_group);
|
||||
private = action_group->priv;
|
||||
|
||||
g_hash_table_foreach (private->actions, add_single_action, &actions);
|
||||
|
||||
@@ -1319,7 +1382,7 @@ gtk_action_group_set_translate_func (GtkActionGroup *action_group,
|
||||
|
||||
g_return_if_fail (GTK_IS_ACTION_GROUP (action_group));
|
||||
|
||||
private = GTK_ACTION_GROUP_GET_PRIVATE (action_group);
|
||||
private = action_group->priv;
|
||||
|
||||
if (private->translate_notify)
|
||||
private->translate_notify (private->translate_data);
|
||||
@@ -1392,7 +1455,7 @@ gtk_action_group_translate_string (GtkActionGroup *action_group,
|
||||
if (string == NULL)
|
||||
return NULL;
|
||||
|
||||
private = GTK_ACTION_GROUP_GET_PRIVATE (action_group);
|
||||
private = action_group->priv;
|
||||
|
||||
translate_func = private->translate_func;
|
||||
translate_data = private->translate_data;
|
||||
|
||||
@@ -59,8 +59,7 @@ struct _GtkActionGroup
|
||||
GObject parent;
|
||||
|
||||
/*< private >*/
|
||||
|
||||
GtkActionGroupPrivate *GSEAL (private_data);
|
||||
GtkActionGroupPrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkActionGroupClass
|
||||
@@ -77,6 +76,23 @@ struct _GtkActionGroupClass
|
||||
void (*_gtk_reserved4) (void);
|
||||
};
|
||||
|
||||
/**
|
||||
* GtkActionEntry:
|
||||
* @name: The name of the action.
|
||||
* @stock_id: The stock id for the action, or the name of an icon from the
|
||||
* icon theme.
|
||||
* @label: The label for the action. This field should typically be marked
|
||||
* for translation, see gtk_action_group_set_translation_domain(). If
|
||||
* @label is %NULL, the label of the stock item with id @stock_id is used.
|
||||
* @accelerator: The accelerator for the action, in the format understood by
|
||||
* gtk_accelerator_parse().
|
||||
* @tooltip: The tooltip for the action. This field should typically be
|
||||
* marked for translation, see gtk_action_group_set_translation_domain().
|
||||
* @callback: The function to call when the action is activated.
|
||||
*
|
||||
* #GtkActionEntry structs are used with gtk_action_group_add_actions() to
|
||||
* construct actions.
|
||||
*/
|
||||
struct _GtkActionEntry
|
||||
{
|
||||
const gchar *name;
|
||||
@@ -87,6 +103,23 @@ struct _GtkActionEntry
|
||||
GCallback callback;
|
||||
};
|
||||
|
||||
/**
|
||||
* GtkToggleActionEntry:
|
||||
* @name: The name of the action.
|
||||
* @stock_id: The stock id for the action, or the name of an icon from the
|
||||
* icon theme.
|
||||
* @label: The label for the action. This field should typically be marked
|
||||
* for translation, see gtk_action_group_set_translation_domain().
|
||||
* @accelerator: The accelerator for the action, in the format understood by
|
||||
* gtk_accelerator_parse().
|
||||
* @tooltip: The tooltip for the action. This field should typically be
|
||||
* marked for translation, see gtk_action_group_set_translation_domain().
|
||||
* @callback: The function to call when the action is activated.
|
||||
* @is_active: The initial state of the toggle action.
|
||||
*
|
||||
* #GtkToggleActionEntry structs are used with
|
||||
* gtk_action_group_add_toggle_actions() to construct toggle actions.
|
||||
*/
|
||||
struct _GtkToggleActionEntry
|
||||
{
|
||||
const gchar *name;
|
||||
@@ -98,6 +131,23 @@ struct _GtkToggleActionEntry
|
||||
gboolean is_active;
|
||||
};
|
||||
|
||||
/**
|
||||
* GtkRadioActionEntry:
|
||||
* @name: The name of the action.
|
||||
* @stock_id: The stock id for the action, or the name of an icon from the
|
||||
* icon theme.
|
||||
* @label: The label for the action. This field should typically be marked
|
||||
* for translation, see gtk_action_group_set_translation_domain().
|
||||
* @accelerator: The accelerator for the action, in the format understood by
|
||||
* gtk_accelerator_parse().
|
||||
* @tooltip: The tooltip for the action. This field should typically be
|
||||
* marked for translation, see gtk_action_group_set_translation_domain().
|
||||
* @value: The value to set on the radio action. See
|
||||
* gtk_radio_action_get_current_value().
|
||||
*
|
||||
* #GtkRadioActionEntry structs are used with
|
||||
* gtk_action_group_add_radio_actions() to construct groups of radio actions.
|
||||
*/
|
||||
struct _GtkRadioActionEntry
|
||||
{
|
||||
const gchar *name;
|
||||
|
||||
@@ -50,6 +50,19 @@
|
||||
#include "gtkintl.h"
|
||||
|
||||
|
||||
struct _GtkAlignmentPriv
|
||||
{
|
||||
gfloat xalign;
|
||||
gfloat yalign;
|
||||
gfloat xscale;
|
||||
gfloat yscale;
|
||||
|
||||
guint padding_bottom;
|
||||
guint padding_top;
|
||||
guint padding_left;
|
||||
guint padding_right;
|
||||
};
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
|
||||
@@ -64,16 +77,6 @@ enum {
|
||||
PROP_RIGHT_PADDING
|
||||
};
|
||||
|
||||
#define GTK_ALIGNMENT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GTK_TYPE_ALIGNMENT, GtkAlignmentPrivate))
|
||||
|
||||
struct _GtkAlignmentPrivate
|
||||
{
|
||||
guint padding_top;
|
||||
guint padding_bottom;
|
||||
guint padding_left;
|
||||
guint padding_right;
|
||||
};
|
||||
|
||||
static void gtk_alignment_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
static void gtk_alignment_set_property (GObject *object,
|
||||
@@ -218,24 +221,28 @@ gtk_alignment_class_init (GtkAlignmentClass *class)
|
||||
0,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
g_type_class_add_private (gobject_class, sizeof (GtkAlignmentPrivate));
|
||||
g_type_class_add_private (gobject_class, sizeof (GtkAlignmentPriv));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_alignment_init (GtkAlignment *alignment)
|
||||
{
|
||||
GtkAlignmentPrivate *priv;
|
||||
|
||||
GtkAlignmentPriv *priv;
|
||||
|
||||
alignment->priv = G_TYPE_INSTANCE_GET_PRIVATE (alignment,
|
||||
GTK_TYPE_ALIGNMENT,
|
||||
GtkAlignmentPriv);
|
||||
priv = alignment->priv;
|
||||
|
||||
gtk_widget_set_has_window (GTK_WIDGET (alignment), FALSE);
|
||||
gtk_widget_set_redraw_on_allocate (GTK_WIDGET (alignment), FALSE);
|
||||
|
||||
alignment->xalign = 0.5;
|
||||
alignment->yalign = 0.5;
|
||||
alignment->xscale = 1.0;
|
||||
alignment->yscale = 1.0;
|
||||
priv->xalign = 0.5;
|
||||
priv->yalign = 0.5;
|
||||
priv->xscale = 1.0;
|
||||
priv->yscale = 1.0;
|
||||
|
||||
/* Initialize padding with default values: */
|
||||
priv = GTK_ALIGNMENT_GET_PRIVATE (alignment);
|
||||
priv->padding_top = 0;
|
||||
priv->padding_bottom = 0;
|
||||
priv->padding_left = 0;
|
||||
@@ -267,13 +274,16 @@ gtk_alignment_new (gfloat xalign,
|
||||
gfloat yscale)
|
||||
{
|
||||
GtkAlignment *alignment;
|
||||
GtkAlignmentPriv *priv;
|
||||
|
||||
alignment = g_object_new (GTK_TYPE_ALIGNMENT, NULL);
|
||||
|
||||
alignment->xalign = CLAMP (xalign, 0.0, 1.0);
|
||||
alignment->yalign = CLAMP (yalign, 0.0, 1.0);
|
||||
alignment->xscale = CLAMP (xscale, 0.0, 1.0);
|
||||
alignment->yscale = CLAMP (yscale, 0.0, 1.0);
|
||||
priv = alignment->priv;
|
||||
|
||||
priv->xalign = CLAMP (xalign, 0.0, 1.0);
|
||||
priv->yalign = CLAMP (yalign, 0.0, 1.0);
|
||||
priv->xscale = CLAMP (xscale, 0.0, 1.0);
|
||||
priv->yscale = CLAMP (yscale, 0.0, 1.0);
|
||||
|
||||
return GTK_WIDGET (alignment);
|
||||
}
|
||||
@@ -284,40 +294,37 @@ gtk_alignment_set_property (GObject *object,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkAlignment *alignment;
|
||||
GtkAlignmentPrivate *priv;
|
||||
|
||||
alignment = GTK_ALIGNMENT (object);
|
||||
priv = GTK_ALIGNMENT_GET_PRIVATE (alignment);
|
||||
|
||||
GtkAlignment *alignment = GTK_ALIGNMENT (object);
|
||||
GtkAlignmentPriv *priv = alignment->priv;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_XALIGN:
|
||||
gtk_alignment_set (alignment,
|
||||
g_value_get_float (value),
|
||||
alignment->yalign,
|
||||
alignment->xscale,
|
||||
alignment->yscale);
|
||||
priv->yalign,
|
||||
priv->xscale,
|
||||
priv->yscale);
|
||||
break;
|
||||
case PROP_YALIGN:
|
||||
gtk_alignment_set (alignment,
|
||||
alignment->xalign,
|
||||
priv->xalign,
|
||||
g_value_get_float (value),
|
||||
alignment->xscale,
|
||||
alignment->yscale);
|
||||
priv->xscale,
|
||||
priv->yscale);
|
||||
break;
|
||||
case PROP_XSCALE:
|
||||
gtk_alignment_set (alignment,
|
||||
alignment->xalign,
|
||||
alignment->yalign,
|
||||
priv->xalign,
|
||||
priv->yalign,
|
||||
g_value_get_float (value),
|
||||
alignment->yscale);
|
||||
priv->yscale);
|
||||
break;
|
||||
case PROP_YSCALE:
|
||||
gtk_alignment_set (alignment,
|
||||
alignment->xalign,
|
||||
alignment->yalign,
|
||||
alignment->xscale,
|
||||
priv->xalign,
|
||||
priv->yalign,
|
||||
priv->xscale,
|
||||
g_value_get_float (value));
|
||||
break;
|
||||
|
||||
@@ -363,25 +370,22 @@ gtk_alignment_get_property (GObject *object,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkAlignment *alignment;
|
||||
GtkAlignmentPrivate *priv;
|
||||
GtkAlignment *alignment = GTK_ALIGNMENT (object);
|
||||
GtkAlignmentPriv *priv = alignment->priv;
|
||||
|
||||
alignment = GTK_ALIGNMENT (object);
|
||||
priv = GTK_ALIGNMENT_GET_PRIVATE (alignment);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_XALIGN:
|
||||
g_value_set_float(value, alignment->xalign);
|
||||
g_value_set_float(value, priv->xalign);
|
||||
break;
|
||||
case PROP_YALIGN:
|
||||
g_value_set_float(value, alignment->yalign);
|
||||
g_value_set_float(value, priv->yalign);
|
||||
break;
|
||||
case PROP_XSCALE:
|
||||
g_value_set_float(value, alignment->xscale);
|
||||
g_value_set_float(value, priv->xscale);
|
||||
break;
|
||||
case PROP_YSCALE:
|
||||
g_value_set_float(value, alignment->yscale);
|
||||
g_value_set_float(value, priv->yscale);
|
||||
break;
|
||||
|
||||
/* Padding: */
|
||||
@@ -428,43 +432,49 @@ gtk_alignment_set (GtkAlignment *alignment,
|
||||
gfloat xscale,
|
||||
gfloat yscale)
|
||||
{
|
||||
GtkAlignmentPriv *priv;
|
||||
GtkWidget *child;
|
||||
|
||||
g_return_if_fail (GTK_IS_ALIGNMENT (alignment));
|
||||
|
||||
priv = alignment->priv;
|
||||
|
||||
xalign = CLAMP (xalign, 0.0, 1.0);
|
||||
yalign = CLAMP (yalign, 0.0, 1.0);
|
||||
xscale = CLAMP (xscale, 0.0, 1.0);
|
||||
yscale = CLAMP (yscale, 0.0, 1.0);
|
||||
|
||||
if ( (alignment->xalign != xalign)
|
||||
|| (alignment->yalign != yalign)
|
||||
|| (alignment->xscale != xscale)
|
||||
|| (alignment->yscale != yscale))
|
||||
if ( (priv->xalign != xalign)
|
||||
|| (priv->yalign != yalign)
|
||||
|| (priv->xscale != xscale)
|
||||
|| (priv->yscale != yscale))
|
||||
{
|
||||
g_object_freeze_notify (G_OBJECT (alignment));
|
||||
if (alignment->xalign != xalign)
|
||||
if (priv->xalign != xalign)
|
||||
{
|
||||
alignment->xalign = xalign;
|
||||
priv->xalign = xalign;
|
||||
g_object_notify (G_OBJECT (alignment), "xalign");
|
||||
}
|
||||
if (alignment->yalign != yalign)
|
||||
if (priv->yalign != yalign)
|
||||
{
|
||||
alignment->yalign = yalign;
|
||||
priv->yalign = yalign;
|
||||
g_object_notify (G_OBJECT (alignment), "yalign");
|
||||
}
|
||||
if (alignment->xscale != xscale)
|
||||
if (priv->xscale != xscale)
|
||||
{
|
||||
alignment->xscale = xscale;
|
||||
priv->xscale = xscale;
|
||||
g_object_notify (G_OBJECT (alignment), "xscale");
|
||||
}
|
||||
if (alignment->yscale != yscale)
|
||||
if (priv->yscale != yscale)
|
||||
{
|
||||
alignment->yscale = yscale;
|
||||
priv->yscale = yscale;
|
||||
g_object_notify (G_OBJECT (alignment), "yscale");
|
||||
}
|
||||
g_object_thaw_notify (G_OBJECT (alignment));
|
||||
|
||||
if (GTK_BIN (alignment)->child)
|
||||
gtk_widget_queue_resize (GTK_BIN (alignment)->child);
|
||||
child = gtk_bin_get_child (GTK_BIN (alignment));
|
||||
if (child)
|
||||
gtk_widget_queue_resize (child);
|
||||
gtk_widget_queue_draw (GTK_WIDGET (alignment));
|
||||
}
|
||||
}
|
||||
@@ -474,31 +484,31 @@ static void
|
||||
gtk_alignment_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation)
|
||||
{
|
||||
GtkAlignment *alignment;
|
||||
GtkAlignment *alignment = GTK_ALIGNMENT (widget);
|
||||
GtkAlignmentPriv *priv = alignment->priv;
|
||||
GtkBin *bin;
|
||||
GtkAllocation child_allocation;
|
||||
GtkWidget *bin_child;
|
||||
gint width, height;
|
||||
gint border_width;
|
||||
guint border_width;
|
||||
gint padding_horizontal, padding_vertical;
|
||||
GtkAlignmentPrivate *priv;
|
||||
|
||||
padding_horizontal = 0;
|
||||
padding_vertical = 0;
|
||||
|
||||
widget->allocation = *allocation;
|
||||
alignment = GTK_ALIGNMENT (widget);
|
||||
bin = GTK_BIN (widget);
|
||||
|
||||
if (bin->child && gtk_widget_get_visible (bin->child))
|
||||
|
||||
bin_child = gtk_bin_get_child (bin);
|
||||
if (bin_child && gtk_widget_get_visible (bin_child))
|
||||
{
|
||||
GtkSizeRequest *child = GTK_SIZE_REQUEST (bin->child);
|
||||
GtkSizeRequest *child = GTK_SIZE_REQUEST (bin_child);
|
||||
gint child_nat_width;
|
||||
gint child_nat_height;
|
||||
gint child_width, child_height;
|
||||
|
||||
border_width = GTK_CONTAINER (alignment)->border_width;
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (alignment));
|
||||
|
||||
priv = GTK_ALIGNMENT_GET_PRIVATE (widget);
|
||||
padding_horizontal = priv->padding_left + priv->padding_right;
|
||||
padding_vertical = priv->padding_top + priv->padding_bottom;
|
||||
|
||||
@@ -528,26 +538,26 @@ gtk_alignment_size_allocate (GtkWidget *widget,
|
||||
|
||||
if (width > child_width)
|
||||
child_allocation.width = (child_width *
|
||||
(1.0 - alignment->xscale) +
|
||||
width * alignment->xscale);
|
||||
(1.0 - priv->xscale) +
|
||||
width * priv->xscale);
|
||||
else
|
||||
child_allocation.width = width;
|
||||
|
||||
if (height > child_height)
|
||||
child_allocation.height = (child_height *
|
||||
(1.0 - alignment->yscale) +
|
||||
height * alignment->yscale);
|
||||
(1.0 - priv->yscale) +
|
||||
height * priv->yscale);
|
||||
else
|
||||
child_allocation.height = height;
|
||||
|
||||
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
|
||||
child_allocation.x = (1.0 - alignment->xalign) * (width - child_allocation.width) + allocation->x + border_width + priv->padding_right;
|
||||
child_allocation.x = (1.0 - priv->xalign) * (width - child_allocation.width) + allocation->x + border_width + priv->padding_right;
|
||||
else
|
||||
child_allocation.x = alignment->xalign * (width - child_allocation.width) + allocation->x + border_width + priv->padding_left;
|
||||
child_allocation.x = priv->xalign * (width - child_allocation.width) + allocation->x + border_width + priv->padding_left;
|
||||
|
||||
child_allocation.y = alignment->yalign * (height - child_allocation.height) + allocation->y + border_width + priv->padding_top;
|
||||
child_allocation.y = priv->yalign * (height - child_allocation.height) + allocation->y + border_width + priv->padding_top;
|
||||
|
||||
gtk_widget_size_allocate (bin->child, &child_allocation);
|
||||
gtk_widget_size_allocate (bin_child, &child_allocation);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -565,13 +575,12 @@ gtk_alignment_get_size (GtkSizeRequest *widget,
|
||||
gint *minimum_size,
|
||||
gint *natural_size)
|
||||
{
|
||||
GtkAlignment *alignment = GTK_ALIGNMENT (widget);
|
||||
GtkAlignmentPriv *priv = alignment->priv;
|
||||
GtkWidget *child;
|
||||
GtkAlignmentPrivate *priv;
|
||||
gint minimum, natural;
|
||||
guint minimum, natural;
|
||||
|
||||
priv = GTK_ALIGNMENT_GET_PRIVATE (widget);
|
||||
|
||||
natural = minimum = GTK_CONTAINER (widget)->border_width * 2;
|
||||
natural = minimum = gtk_container_get_border_width (GTK_CONTAINER (widget)) * 2;
|
||||
|
||||
if ((child = gtk_bin_get_child (GTK_BIN (widget))) && gtk_widget_get_visible (child))
|
||||
{
|
||||
@@ -642,11 +651,12 @@ gtk_alignment_set_padding (GtkAlignment *alignment,
|
||||
guint padding_left,
|
||||
guint padding_right)
|
||||
{
|
||||
GtkAlignmentPrivate *priv;
|
||||
GtkAlignmentPriv *priv;
|
||||
GtkWidget *child;
|
||||
|
||||
g_return_if_fail (GTK_IS_ALIGNMENT (alignment));
|
||||
|
||||
priv = GTK_ALIGNMENT_GET_PRIVATE (alignment);
|
||||
priv = alignment->priv;
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (alignment));
|
||||
|
||||
@@ -674,8 +684,9 @@ gtk_alignment_set_padding (GtkAlignment *alignment,
|
||||
g_object_thaw_notify (G_OBJECT (alignment));
|
||||
|
||||
/* Make sure that the widget and children are redrawn with the new setting: */
|
||||
if (GTK_BIN (alignment)->child)
|
||||
gtk_widget_queue_resize (GTK_BIN (alignment)->child);
|
||||
child = gtk_bin_get_child (GTK_BIN (alignment));
|
||||
if (child)
|
||||
gtk_widget_queue_resize (child);
|
||||
|
||||
gtk_widget_queue_draw (GTK_WIDGET (alignment));
|
||||
}
|
||||
@@ -700,11 +711,12 @@ gtk_alignment_get_padding (GtkAlignment *alignment,
|
||||
guint *padding_left,
|
||||
guint *padding_right)
|
||||
{
|
||||
GtkAlignmentPrivate *priv;
|
||||
|
||||
GtkAlignmentPriv *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_ALIGNMENT (alignment));
|
||||
|
||||
priv = GTK_ALIGNMENT_GET_PRIVATE (alignment);
|
||||
priv = alignment->priv;
|
||||
|
||||
if(padding_top)
|
||||
*padding_top = priv->padding_top;
|
||||
if(padding_bottom)
|
||||
|
||||
@@ -46,17 +46,15 @@ G_BEGIN_DECLS
|
||||
|
||||
|
||||
typedef struct _GtkAlignment GtkAlignment;
|
||||
typedef struct _GtkAlignmentPriv GtkAlignmentPriv;
|
||||
typedef struct _GtkAlignmentClass GtkAlignmentClass;
|
||||
typedef struct _GtkAlignmentPrivate GtkAlignmentPrivate;
|
||||
|
||||
struct _GtkAlignment
|
||||
{
|
||||
GtkBin bin;
|
||||
|
||||
gfloat GSEAL (xalign);
|
||||
gfloat GSEAL (yalign);
|
||||
gfloat GSEAL (xscale);
|
||||
gfloat GSEAL (yscale);
|
||||
/* <private> */
|
||||
GtkAlignmentPriv *priv;
|
||||
};
|
||||
|
||||
struct _GtkAlignmentClass
|
||||
|
||||
@@ -33,10 +33,8 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "gtkapplication.h"
|
||||
#include "gtkwindow.h"
|
||||
#include "gtkmain.h"
|
||||
#include "gtkmarshalers.h"
|
||||
#include "gtkintl.h"
|
||||
#include "gtkprivate.h"
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
@@ -66,646 +64,250 @@
|
||||
* </programlisting>
|
||||
* </example>
|
||||
*/
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
|
||||
PROP_WINDOW
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
ACTIVATED,
|
||||
QUIT,
|
||||
ACTION,
|
||||
|
||||
LAST_SIGNAL
|
||||
PROP_NONE,
|
||||
PROP_ACTION_GROUP,
|
||||
PROP_DEFAULT_WINDOW
|
||||
};
|
||||
|
||||
static guint gtk_application_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
struct _GtkApplicationPrivate
|
||||
{
|
||||
GtkActionGroup *main_actions;
|
||||
|
||||
GtkActionGroup *action_group;
|
||||
GtkWindow *default_window;
|
||||
GSList *windows;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GtkApplication, gtk_application, G_TYPE_APPLICATION)
|
||||
|
||||
static void
|
||||
process_timestamp_from_platform_data (GVariant *platform_data)
|
||||
gtk_application_set_property (GObject *object, guint prop_id,
|
||||
const GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
/* TODO - extract timestamp from here, update GDK time */
|
||||
}
|
||||
GtkApplication *application = GTK_APPLICATION (object);
|
||||
|
||||
static gboolean
|
||||
gtk_application_default_quit (GtkApplication *application)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_application_default_quit_with_data (GApplication *application,
|
||||
GVariant *platform_data)
|
||||
{
|
||||
gboolean result;
|
||||
|
||||
process_timestamp_from_platform_data (platform_data);
|
||||
|
||||
g_signal_emit (application, gtk_application_signals[QUIT], 0, &result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_application_default_run (GApplication *application)
|
||||
{
|
||||
gtk_main ();
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_application_default_prepare_activation (GApplication *application,
|
||||
GVariant *arguments,
|
||||
GVariant *platform_data)
|
||||
{
|
||||
GVariantIter iter;
|
||||
const gchar *key;
|
||||
GVariant *value;
|
||||
|
||||
g_variant_iter_init (&iter, platform_data);
|
||||
while (g_variant_iter_next (&iter, "{&sv}", &key, &value))
|
||||
switch (prop_id)
|
||||
{
|
||||
if (strcmp (key, "startup-notification-id") == 0 &&
|
||||
g_variant_is_of_type (value, G_VARIANT_TYPE_STRING))
|
||||
gdk_notify_startup_complete_with_id (g_variant_get_string (value, NULL));
|
||||
g_variant_unref (value);
|
||||
case PROP_ACTION_GROUP:
|
||||
gtk_application_set_action_group (application,
|
||||
g_value_get_object (value));
|
||||
break;
|
||||
|
||||
case PROP_DEFAULT_WINDOW:
|
||||
gtk_application_set_default_window (application,
|
||||
g_value_get_object (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
g_signal_emit (G_OBJECT (application), gtk_application_signals[ACTIVATED], 0, arguments);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_application_default_activated (GtkApplication *application,
|
||||
GVariant *arguments)
|
||||
gtk_application_get_property (GObject *object, guint prop_id,
|
||||
GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
GtkApplicationPrivate *priv = application->priv;
|
||||
GtkApplication *application = GTK_APPLICATION (object);
|
||||
|
||||
/* TODO: should we raise the last focused window instead ? */
|
||||
if (priv->default_window != NULL)
|
||||
gtk_window_present (priv->default_window);
|
||||
}
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_ACTION_GROUP:
|
||||
g_value_set_object (value,
|
||||
gtk_application_get_action_group (application));
|
||||
break;
|
||||
|
||||
static void
|
||||
gtk_application_default_action (GtkApplication *application,
|
||||
const gchar *action_name)
|
||||
{
|
||||
GtkApplicationPrivate *priv = application->priv;
|
||||
GtkAction *action;
|
||||
case PROP_DEFAULT_WINDOW:
|
||||
g_value_set_object (value,
|
||||
gtk_application_get_default_window (application));
|
||||
break;
|
||||
|
||||
action = gtk_action_group_get_action (priv->main_actions, action_name);
|
||||
if (action)
|
||||
gtk_action_activate (action);
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
|
||||
static GtkWindow *
|
||||
gtk_application_default_create_window (GtkApplication *application)
|
||||
gtk_application_real_create_window (GtkApplication *application)
|
||||
{
|
||||
return GTK_WINDOW (gtk_window_new (GTK_WINDOW_TOPLEVEL));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_application_default_action_with_data (GApplication *application,
|
||||
const gchar *action_name,
|
||||
GVariant *platform_data)
|
||||
gtk_application_activate (GApplication *gapplication)
|
||||
{
|
||||
process_timestamp_from_platform_data (platform_data);
|
||||
GtkApplication *application = GTK_APPLICATION (gapplication);
|
||||
|
||||
g_signal_emit (application, gtk_application_signals[ACTION], g_quark_from_string (action_name));
|
||||
}
|
||||
|
||||
static GVariant *
|
||||
gtk_application_format_activation_data (void)
|
||||
{
|
||||
const gchar *startup_id = NULL;
|
||||
GdkDisplay *display = gdk_display_get_default ();
|
||||
GVariantBuilder builder;
|
||||
|
||||
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
|
||||
|
||||
/* try and get the startup notification id from GDK, the environment
|
||||
* or, if everything else failed, fake one.
|
||||
*/
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
startup_id = gdk_x11_display_get_startup_notification_id (display);
|
||||
#endif /* GDK_WINDOWING_X11 */
|
||||
|
||||
if (startup_id)
|
||||
g_variant_builder_add (&builder, "{sv}", "startup-notification-id",
|
||||
g_variant_new ("s", startup_id));
|
||||
return g_variant_builder_end (&builder);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_application_new:
|
||||
* @appid: System-dependent application identifier
|
||||
* @argc: (allow-none) (inout): System argument count
|
||||
* @argv: (allow-none) (inout): System argument vector
|
||||
*
|
||||
* Create a new #GtkApplication, or if one has already been initialized
|
||||
* in this process, return the existing instance. This function will as
|
||||
* a side effect initialize the display system; see gtk_init().
|
||||
*
|
||||
* For the behavior if this application is running in another process,
|
||||
* see g_application_new().
|
||||
*
|
||||
* Returns: (transfer full): A newly-referenced #GtkApplication
|
||||
*
|
||||
* Since: 3.0
|
||||
*/
|
||||
GtkApplication*
|
||||
gtk_application_new (const gchar *appid,
|
||||
gint *argc,
|
||||
gchar ***argv)
|
||||
{
|
||||
GtkApplication *app;
|
||||
gint argc_for_app;
|
||||
const gchar **argv_for_app;
|
||||
GVariant *argv_variant;
|
||||
GError *error = NULL;
|
||||
|
||||
gtk_init (argc, argv);
|
||||
|
||||
if (argc)
|
||||
argc_for_app = *argc;
|
||||
else
|
||||
argc_for_app = 0;
|
||||
|
||||
if (argv)
|
||||
argv_for_app = (const gchar **) *argv;
|
||||
else
|
||||
argv_for_app = NULL;
|
||||
|
||||
argv_variant = g_variant_new_bytestring_array (argv_for_app, argc_for_app);
|
||||
|
||||
app = g_initable_new (GTK_TYPE_APPLICATION,
|
||||
NULL,
|
||||
&error,
|
||||
"application-id", appid,
|
||||
"argv", argv_variant,
|
||||
NULL);
|
||||
if (app == NULL)
|
||||
if (application->priv->default_window == NULL)
|
||||
{
|
||||
g_error ("%s", error->message);
|
||||
g_clear_error (&error);
|
||||
return NULL;
|
||||
GtkWindow *window;
|
||||
|
||||
window = GTK_APPLICATION_GET_CLASS (application)
|
||||
->create_window (application);
|
||||
|
||||
if (window != NULL)
|
||||
gtk_application_set_default_window (application, window);
|
||||
}
|
||||
|
||||
return app;
|
||||
if (application->priv->default_window != NULL)
|
||||
gtk_window_present (application->priv->default_window);
|
||||
}
|
||||
|
||||
static void
|
||||
on_action_sensitive (GtkAction *action,
|
||||
GParamSpec *pspec,
|
||||
GtkApplication *app)
|
||||
gtk_application_action (GApplication *gapplication,
|
||||
const gchar *action_name,
|
||||
GVariant *parameters)
|
||||
{
|
||||
g_application_set_action_enabled (G_APPLICATION (app),
|
||||
gtk_action_get_name (action),
|
||||
gtk_action_get_sensitive (action));
|
||||
}
|
||||
GtkApplication *application = GTK_APPLICATION (gapplication);
|
||||
|
||||
/**
|
||||
* gtk_application_set_action_group:
|
||||
* @app: A #GtkApplication
|
||||
* @group: A #GtkActionGroup
|
||||
*
|
||||
* Set @group as this application's global action group.
|
||||
* This will ensure the operating system interface uses
|
||||
* these actions as follows:
|
||||
*
|
||||
* <itemizedlist>
|
||||
* <listitem>In GNOME 2 this exposes the actions for scripting.</listitem>
|
||||
* <listitem>In GNOME 3, this function populates the application menu.</listitem>
|
||||
* <listitem>In Windows prior to version 7, this function does nothing.</listitem>
|
||||
* <listitem>In Windows 7, this function adds "Tasks" to the Jump List.</listitem>
|
||||
* <listitem>In Mac OS X, this function extends the Dock menu.</listitem>
|
||||
* </itemizedlist>
|
||||
*
|
||||
* It is an error to call this function more than once.
|
||||
*
|
||||
* Since: 3.0
|
||||
*/
|
||||
void
|
||||
gtk_application_set_action_group (GtkApplication *app,
|
||||
GtkActionGroup *group)
|
||||
{
|
||||
GList *actions, *iter;
|
||||
|
||||
g_return_if_fail (GTK_IS_APPLICATION (app));
|
||||
g_return_if_fail (GTK_IS_ACTION_GROUP (group));
|
||||
g_return_if_fail (app->priv->main_actions == NULL);
|
||||
|
||||
app->priv->main_actions = g_object_ref (group);
|
||||
actions = gtk_action_group_list_actions (group);
|
||||
for (iter = actions; iter; iter = iter->next)
|
||||
if (parameters == NULL && application->priv->action_group != NULL)
|
||||
{
|
||||
GtkAction *action = iter->data;
|
||||
g_application_add_action (G_APPLICATION (app),
|
||||
gtk_action_get_name (action),
|
||||
gtk_action_get_tooltip (action));
|
||||
g_signal_connect (action, "notify::sensitive",
|
||||
G_CALLBACK (on_action_sensitive), app);
|
||||
GtkAction *action;
|
||||
|
||||
action = gtk_action_group_get_action (application->priv->action_group,
|
||||
action_name);
|
||||
|
||||
if (action != NULL)
|
||||
{
|
||||
gtk_action_activate (action);
|
||||
return;
|
||||
}
|
||||
}
|
||||
g_list_free (actions);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_application_on_window_destroy (GtkWidget *window,
|
||||
gpointer user_data)
|
||||
GtkApplication *
|
||||
gtk_application_new (const gchar *application_id,
|
||||
GApplicationFlags flags,
|
||||
GtkActionGroup *action_group)
|
||||
{
|
||||
GtkApplication *app = GTK_APPLICATION (user_data);
|
||||
g_return_val_if_fail (g_application_id_is_valid (application_id), NULL);
|
||||
|
||||
app->priv->windows = g_slist_remove (app->priv->windows, window);
|
||||
gtk_init (NULL, NULL);
|
||||
|
||||
if (app->priv->windows == NULL)
|
||||
gtk_application_quit (app);
|
||||
|
||||
return FALSE;
|
||||
return g_object_new (GTK_TYPE_APPLICATION,
|
||||
"application-id", application_id,
|
||||
"flags", flags,
|
||||
"action-group", action_group,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static gchar *default_title;
|
||||
GtkActionGroup *
|
||||
gtk_application_get_action_group (GtkApplication *application)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_APPLICATION (application), NULL);
|
||||
|
||||
return application->priv->action_group;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_application_add_window:
|
||||
* @app: a #GtkApplication
|
||||
* @window: a toplevel window to add to @app
|
||||
*
|
||||
* Adds a window to the #GtkApplication.
|
||||
*
|
||||
* If all the windows managed by #GtkApplication are closed, the
|
||||
* #GtkApplication will call gtk_application_quit(), and quit
|
||||
* the application.
|
||||
*
|
||||
* If your application uses only a single toplevel window, you can
|
||||
* use gtk_application_get_window(). If you are using a sub-class
|
||||
* of #GtkApplication you should call gtk_application_create_window()
|
||||
* to let the #GtkApplication instance create a #GtkWindow and add
|
||||
* it to the list of toplevels of the application. You should call
|
||||
* this function only to add #GtkWindow<!-- -->s that you created
|
||||
* directly using gtk_window_new().
|
||||
*
|
||||
* Since: 3.0
|
||||
*/
|
||||
void
|
||||
gtk_application_add_window (GtkApplication *app,
|
||||
GtkWindow *window)
|
||||
gtk_application_set_action_group (GtkApplication *application,
|
||||
GtkActionGroup *action_group)
|
||||
{
|
||||
GtkApplicationPrivate *priv;
|
||||
g_return_if_fail (GTK_IS_APPLICATION (application));
|
||||
g_return_if_fail (action_group == NULL || GTK_IS_ACTION_GROUP (action_group));
|
||||
|
||||
g_return_if_fail (GTK_IS_APPLICATION (app));
|
||||
g_return_if_fail (GTK_IS_WINDOW (window));
|
||||
if (application->priv->action_group != action_group)
|
||||
{
|
||||
if (application->priv->action_group)
|
||||
g_object_unref (application->priv->action_group);
|
||||
|
||||
priv = app->priv;
|
||||
application->priv->action_group = action_group;
|
||||
|
||||
if (g_slist_find (priv->windows, window) != NULL)
|
||||
return;
|
||||
if (application->priv->action_group)
|
||||
g_object_ref (application->priv->action_group);
|
||||
|
||||
priv->windows = g_slist_prepend (priv->windows, window);
|
||||
/* XXX synch the list... */
|
||||
|
||||
if (priv->default_window == NULL)
|
||||
priv->default_window = window;
|
||||
|
||||
if (gtk_window_get_title (window) == NULL && default_title != NULL)
|
||||
gtk_window_set_title (window, default_title);
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_application_on_window_destroy),
|
||||
app);
|
||||
g_object_notify (G_OBJECT (application), "action-group");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_application_get_window:
|
||||
* @app: a #GtkApplication
|
||||
*
|
||||
* A simple #GtkApplication has a "default window". This window should
|
||||
* act as the primary user interaction point with your application.
|
||||
* The window returned by this function is of type #GTK_WINDOW_TYPE_TOPLEVEL
|
||||
* and its properties such as "title" and "icon-name" will be initialized
|
||||
* as appropriate for the platform.
|
||||
*
|
||||
* If the user closes this window, and your application hasn't created
|
||||
* any other windows, the default action will be to call gtk_application_quit().
|
||||
*
|
||||
* If your application has more than one toplevel window (e.g. an
|
||||
* single-document-interface application with multiple open documents),
|
||||
* or if you are constructing your toplevel windows yourself (e.g. using
|
||||
* #GtkBuilder), use gtk_application_create_window() or
|
||||
* gtk_application_add_window() instead.
|
||||
*
|
||||
* Returns: (transfer none): The default #GtkWindow for this application
|
||||
*
|
||||
* Since: 3.0
|
||||
*/
|
||||
GtkWindow *
|
||||
gtk_application_get_window (GtkApplication *app)
|
||||
gtk_application_get_default_window (GtkApplication *application)
|
||||
{
|
||||
GtkApplicationPrivate *priv;
|
||||
g_return_val_if_fail (GTK_IS_APPLICATION (application), NULL);
|
||||
|
||||
g_return_val_if_fail (GTK_IS_APPLICATION (app), NULL);
|
||||
|
||||
priv = app->priv;
|
||||
|
||||
if (priv->default_window != NULL)
|
||||
return priv->default_window;
|
||||
|
||||
return gtk_application_create_window (app);
|
||||
return application->priv->default_window;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_application_create_window:
|
||||
* @app: a #GtkApplication
|
||||
*
|
||||
* Creates a new #GtkWindow for the application.
|
||||
*
|
||||
* This function calls the #GtkApplication::create_window() virtual function,
|
||||
* which can be overridden by sub-classes, for instance to use #GtkBuilder to
|
||||
* create the user interface. After creating a new #GtkWindow instance, it will
|
||||
* be added to the list of toplevels associated to the application.
|
||||
*
|
||||
* Return value: (transfer none): the newly created application #GtkWindow
|
||||
*
|
||||
* Since: 3.0
|
||||
*/
|
||||
GtkWindow *
|
||||
gtk_application_create_window (GtkApplication *app)
|
||||
{
|
||||
GtkWindow *window;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_APPLICATION (app), NULL);
|
||||
|
||||
window = GTK_APPLICATION_GET_CLASS (app)->create_window (app);
|
||||
gtk_application_add_window (app, window);
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_application_run:
|
||||
* @app: a #GtkApplication
|
||||
*
|
||||
* Runs the main loop; see g_application_run().
|
||||
* The default implementation for #GtkApplication uses gtk_main().
|
||||
*
|
||||
* Since: 3.0
|
||||
*/
|
||||
void
|
||||
gtk_application_run (GtkApplication *app)
|
||||
gtk_application_set_default_window (GtkApplication *application,
|
||||
GtkWindow *window)
|
||||
{
|
||||
g_application_run (G_APPLICATION (app));
|
||||
}
|
||||
g_return_if_fail (GTK_IS_APPLICATION (application));
|
||||
g_return_if_fail (window == NULL || GTK_IS_WINDOW (window));
|
||||
|
||||
/**
|
||||
* gtk_application_quit:
|
||||
* @app: a #GtkApplication
|
||||
*
|
||||
* Request the application exit. This function invokes
|
||||
* g_application_quit_with_data(), which normally will
|
||||
* in turn cause @app to emit #GtkApplication::quit.
|
||||
*
|
||||
* To control an application's quit behavior (for example, to ask for
|
||||
* files to be saved), connect to the #GtkApplication::quit signal
|
||||
* handler.
|
||||
*
|
||||
* Since: 3.0
|
||||
*/
|
||||
void
|
||||
gtk_application_quit (GtkApplication *app)
|
||||
{
|
||||
GVariantBuilder builder;
|
||||
GVariant *platform_data;
|
||||
|
||||
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
|
||||
g_variant_builder_add (&builder, "{sv}",
|
||||
"timestamp",
|
||||
g_variant_new ("u", gtk_get_current_event_time ()));
|
||||
platform_data = g_variant_builder_end (&builder);
|
||||
|
||||
g_application_quit_with_data (G_APPLICATION (app), platform_data);
|
||||
|
||||
g_variant_unref (platform_data);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_application_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkApplication *app = GTK_APPLICATION (object);
|
||||
|
||||
switch (prop_id)
|
||||
if (application->priv->default_window != window)
|
||||
{
|
||||
case PROP_WINDOW:
|
||||
g_value_set_object (value, gtk_application_get_window (app));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
if (window)
|
||||
gtk_window_set_application (window, application);
|
||||
|
||||
application->priv->default_window = window;
|
||||
|
||||
g_object_notify (G_OBJECT (application), "default-window");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_application_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
gtk_application_quit_mainloop (GApplication *application)
|
||||
{
|
||||
GtkApplication *app = GTK_APPLICATION (object);
|
||||
|
||||
g_assert (app != NULL);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
gtk_main_quit ();
|
||||
}
|
||||
|
||||
static void
|
||||
setup_default_window_decorations (void)
|
||||
gtk_application_run_mainloop (GApplication *application)
|
||||
{
|
||||
const gchar *pid;
|
||||
const gchar *filename;
|
||||
GKeyFile *keyfile;
|
||||
gchar *title;
|
||||
gchar *icon_name;
|
||||
gtk_main ();
|
||||
}
|
||||
|
||||
pid = g_getenv ("GIO_LAUNCHED_DESKTOP_FILE_PID");
|
||||
filename = g_getenv ("GIO_LAUNCHED_DESKTOP_FILE");
|
||||
static void
|
||||
gtk_application_finalize (GObject *object)
|
||||
{
|
||||
GtkApplication *application = GTK_APPLICATION (object);
|
||||
|
||||
keyfile = g_key_file_new ();
|
||||
if (application->priv->action_group)
|
||||
g_object_unref (application->priv->action_group);
|
||||
|
||||
if (pid != NULL && filename != NULL && atoi (pid) == getpid () &&
|
||||
g_key_file_load_from_file (keyfile, filename, 0, NULL))
|
||||
{
|
||||
title = g_key_file_get_locale_string (keyfile, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_NAME, NULL, NULL);
|
||||
icon_name = g_key_file_get_string (keyfile, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_ICON, NULL);
|
||||
|
||||
if (default_title == NULL)
|
||||
default_title = title;
|
||||
|
||||
if (gtk_window_get_default_icon_name () == NULL)
|
||||
gtk_window_set_default_icon_name (icon_name);
|
||||
|
||||
g_free (icon_name);
|
||||
}
|
||||
|
||||
g_key_file_free (keyfile);
|
||||
G_OBJECT_CLASS (gtk_application_parent_class)
|
||||
->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_application_init (GtkApplication *application)
|
||||
{
|
||||
application->priv = G_TYPE_INSTANCE_GET_PRIVATE (application, GTK_TYPE_APPLICATION, GtkApplicationPrivate);
|
||||
|
||||
g_object_set (application, "platform-data", gtk_application_format_activation_data (), NULL);
|
||||
|
||||
setup_default_window_decorations ();
|
||||
}
|
||||
|
||||
|
||||
static GObject*
|
||||
gtk_application_constructor (GType type,
|
||||
guint n_construct_properties,
|
||||
GObjectConstructParam *construct_params)
|
||||
{
|
||||
GObject *object;
|
||||
|
||||
/* Last ditch effort here */
|
||||
gtk_init (0, NULL);
|
||||
|
||||
object = (* G_OBJECT_CLASS (gtk_application_parent_class)->constructor) (type,
|
||||
n_construct_properties,
|
||||
construct_params);
|
||||
|
||||
return object;
|
||||
application->priv = G_TYPE_INSTANCE_GET_PRIVATE (application,
|
||||
GTK_TYPE_APPLICATION,
|
||||
GtkApplicationPrivate);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_application_class_init (GtkApplicationClass *klass)
|
||||
gtk_application_class_init (GtkApplicationClass *class)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
GApplicationClass *application_class;
|
||||
GApplicationClass *application_class = G_APPLICATION_CLASS (class);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
|
||||
gobject_class = G_OBJECT_CLASS (klass);
|
||||
application_class = G_APPLICATION_CLASS (klass);
|
||||
object_class->set_property = gtk_application_set_property;
|
||||
object_class->get_property = gtk_application_get_property;
|
||||
|
||||
gobject_class->constructor = gtk_application_constructor;
|
||||
gobject_class->get_property = gtk_application_get_property;
|
||||
gobject_class->set_property = gtk_application_set_property;
|
||||
class->create_window = gtk_application_real_create_window;
|
||||
|
||||
application_class->run = gtk_application_default_run;
|
||||
application_class->quit_with_data = gtk_application_default_quit_with_data;
|
||||
application_class->action_with_data = gtk_application_default_action_with_data;
|
||||
application_class->prepare_activation = gtk_application_default_prepare_activation;
|
||||
application_class->quit_mainloop = gtk_application_quit_mainloop;
|
||||
application_class->run_mainloop = gtk_application_run_mainloop;
|
||||
application_class->activate = gtk_application_activate;
|
||||
application_class->action = gtk_application_action;
|
||||
|
||||
klass->quit = gtk_application_default_quit;
|
||||
klass->action = gtk_application_default_action;
|
||||
klass->create_window = gtk_application_default_create_window;
|
||||
object_class->finalize = gtk_application_finalize;
|
||||
|
||||
klass->activated = gtk_application_default_activated;
|
||||
g_object_class_install_property (object_class, PROP_ACTION_GROUP,
|
||||
g_param_spec_object ("action-group", "action group",
|
||||
"the GtkActionGroup for the application",
|
||||
GTK_TYPE_ACTION_GROUP, G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* GtkApplication::activated:
|
||||
* @arguments: A #GVariant with the signature "aay"
|
||||
*
|
||||
* This signal is emitted when a non-primary process for a given
|
||||
* application is invoked while your application is running; for
|
||||
* example, when a file browser launches your program to open a
|
||||
* file. The raw operating system arguments are passed in the
|
||||
* variant @arguments.
|
||||
*
|
||||
* Since: 3.0
|
||||
*/
|
||||
gtk_application_signals[ACTIVATED] =
|
||||
g_signal_new (g_intern_static_string ("activated"),
|
||||
G_OBJECT_CLASS_TYPE (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GtkApplicationClass, activated),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VARIANT,
|
||||
G_TYPE_NONE, 1,
|
||||
G_TYPE_VARIANT);
|
||||
g_object_class_install_property (object_class, PROP_DEFAULT_WINDOW,
|
||||
g_param_spec_object ("default-window", "default window",
|
||||
"the default window for the application",
|
||||
GTK_TYPE_WINDOW,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* GtkApplication::quit:
|
||||
* @application: the object on which the signal is emitted
|
||||
*
|
||||
* This signal is emitted when a quit is initiated. See also
|
||||
* the #GApplication::quit-with-data signal which may in
|
||||
* turn trigger this signal.
|
||||
*
|
||||
* The default handler for this signal exits the mainloop of the
|
||||
* application. It is possible to override the default handler
|
||||
* by simply returning %TRUE from a callback, e.g.:
|
||||
*
|
||||
* |[
|
||||
* static gboolean
|
||||
* my_application_quit (GtkApplication *application)
|
||||
* {
|
||||
* /* if some_condition is TRUE, do not quit */
|
||||
* if (some_condition)
|
||||
* return TRUE;
|
||||
*
|
||||
* /* this will cause the application to quit *
|
||||
* return FALSE;
|
||||
* }
|
||||
*
|
||||
* g_signal_connect (application, "quit",
|
||||
* G_CALLBACK (my_application_quit),
|
||||
* NULL);
|
||||
* ]|
|
||||
*
|
||||
* Returns: %TRUE if the signal has been handled, %FALSE to continue
|
||||
* signal emission
|
||||
*
|
||||
* Since: 3.0
|
||||
*/
|
||||
gtk_application_signals[QUIT] =
|
||||
g_signal_new (g_intern_static_string ("quit"),
|
||||
G_OBJECT_CLASS_TYPE (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GtkApplicationClass, quit),
|
||||
g_signal_accumulator_true_handled, NULL,
|
||||
_gtk_marshal_BOOLEAN__VOID,
|
||||
G_TYPE_BOOLEAN, 0);
|
||||
|
||||
/**
|
||||
* GtkApplication::action:
|
||||
* @application: the object on which the signal is emitted
|
||||
* @name: The name of the activated action
|
||||
*
|
||||
* This signal is emitted when an action is activated. The action name
|
||||
* is passed as the first argument, but also as signal detail, so it
|
||||
* is possible to connect to this signal for individual actions.
|
||||
*
|
||||
* See also the #GApplication::action-with-data signal which may in
|
||||
* turn trigger this signal.
|
||||
*
|
||||
* The signal is never emitted for disabled actions.
|
||||
*
|
||||
* Since: 3.0
|
||||
*/
|
||||
gtk_application_signals[ACTION] =
|
||||
g_signal_new (g_intern_static_string ("action"),
|
||||
G_OBJECT_CLASS_TYPE (klass),
|
||||
G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE | G_SIGNAL_DETAILED,
|
||||
G_STRUCT_OFFSET (GtkApplicationClass, action),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__STRING,
|
||||
G_TYPE_NONE, 1,
|
||||
G_TYPE_STRING);
|
||||
|
||||
g_type_class_add_private (gobject_class, sizeof (GtkApplicationPrivate));
|
||||
g_type_class_add_private (object_class, sizeof (GtkApplicationPrivate));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
*
|
||||
/*
|
||||
* Copyright © 2010 Codethink Limited
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
@@ -17,14 +17,8 @@
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Author: Colin Walters <walters@verbum.org>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
||||
* file for a list of people on the GTK+ Team. See the ChangeLog
|
||||
* files for a list of changes. These files are distributed with
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
* Author: Ryan Lortie <desrt@desrt.ca>
|
||||
* Colin Walters <walters@verbum.org>
|
||||
*/
|
||||
|
||||
#if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
@@ -34,10 +28,9 @@
|
||||
#ifndef __GTK_APPLICATION_H__
|
||||
#define __GTK_APPLICATION_H__
|
||||
|
||||
#include <gio/gio.h>
|
||||
#include <gtk/gtkaction.h>
|
||||
#include <gtk/gtkactiongroup.h>
|
||||
#include <gtk/gtkwindow.h>
|
||||
#include <gtk/gtkwidget.h>
|
||||
#include <gio/gio.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -57,7 +50,6 @@ struct _GtkApplication
|
||||
GApplication parent;
|
||||
|
||||
/*< private >*/
|
||||
|
||||
GtkApplicationPrivate *priv;
|
||||
};
|
||||
|
||||
@@ -67,38 +59,24 @@ struct _GtkApplicationClass
|
||||
|
||||
/*< vfuncs >*/
|
||||
GtkWindow *(* create_window) (GtkApplication *application);
|
||||
void (* activated) (GtkApplication *application,
|
||||
GVariant *args);
|
||||
void (* action) (GtkApplication *application,
|
||||
const gchar *action_name);
|
||||
gboolean (* quit) (GtkApplication *application);
|
||||
|
||||
|
||||
/* Padding for future expansion */
|
||||
void (*_gtk_reserved1) (void);
|
||||
void (*_gtk_reserved2) (void);
|
||||
void (*_gtk_reserved3) (void);
|
||||
void (*_gtk_reserved4) (void);
|
||||
void (*_gtk_reserved5) (void);
|
||||
void (*_gtk_reserved6) (void);
|
||||
void (*_gtk_reserved7) (void);
|
||||
void (*_gtk_reserved8) (void);
|
||||
void (*_gtk_reserved9) (void);
|
||||
void (*_gtk_reserved10) (void);
|
||||
/*< private >*/
|
||||
gpointer padding[12];
|
||||
};
|
||||
|
||||
GType gtk_application_get_type (void) G_GNUC_CONST;
|
||||
GtkApplication* gtk_application_new (const gchar *appid,
|
||||
gint *argc,
|
||||
gchar ***argv);
|
||||
void gtk_application_set_action_group (GtkApplication *app,
|
||||
GtkActionGroup *group);
|
||||
GtkWindow * gtk_application_create_window (GtkApplication *app);
|
||||
GtkWindow * gtk_application_get_window (GtkApplication *app);
|
||||
void gtk_application_add_window (GtkApplication *app,
|
||||
GtkWindow *window);
|
||||
void gtk_application_run (GtkApplication *app);
|
||||
void gtk_application_quit (GtkApplication *app);
|
||||
GType gtk_application_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkApplication* gtk_application_new (const gchar *appid,
|
||||
GApplicationFlags flags,
|
||||
GtkActionGroup *action_group);
|
||||
|
||||
GtkActionGroup * gtk_application_get_action_group (GtkApplication *application);
|
||||
void gtk_application_set_action_group (GtkApplication *application,
|
||||
GtkActionGroup *action_group);
|
||||
|
||||
GtkWindow * gtk_application_get_default_window (GtkApplication *application);
|
||||
void gtk_application_set_default_window (GtkApplication *application,
|
||||
GtkWindow *window);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -52,6 +52,12 @@
|
||||
|
||||
#define MIN_ARROW_SIZE 15
|
||||
|
||||
struct _GtkArrowPriv
|
||||
{
|
||||
gint16 arrow_type;
|
||||
gint16 shadow_type;
|
||||
};
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_ARROW_TYPE,
|
||||
@@ -112,6 +118,8 @@ gtk_arrow_class_init (GtkArrowClass *class)
|
||||
P_("Amount of space used up by arrow"),
|
||||
0.0, 1.0, 0.7,
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
g_type_class_add_private (class, sizeof (GtkArrowPriv));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -121,17 +129,18 @@ gtk_arrow_set_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkArrow *arrow = GTK_ARROW (object);
|
||||
GtkArrowPriv *priv = arrow->priv;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_ARROW_TYPE:
|
||||
gtk_arrow_set (arrow,
|
||||
g_value_get_enum (value),
|
||||
arrow->shadow_type);
|
||||
priv->shadow_type);
|
||||
break;
|
||||
case PROP_SHADOW_TYPE:
|
||||
gtk_arrow_set (arrow,
|
||||
arrow->arrow_type,
|
||||
priv->arrow_type,
|
||||
g_value_get_enum (value));
|
||||
break;
|
||||
default:
|
||||
@@ -147,14 +156,15 @@ gtk_arrow_get_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkArrow *arrow = GTK_ARROW (object);
|
||||
GtkArrowPriv *priv = arrow->priv;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_ARROW_TYPE:
|
||||
g_value_set_enum (value, arrow->arrow_type);
|
||||
g_value_set_enum (value, priv->arrow_type);
|
||||
break;
|
||||
case PROP_SHADOW_TYPE:
|
||||
g_value_set_enum (value, arrow->shadow_type);
|
||||
g_value_set_enum (value, priv->shadow_type);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
@@ -165,13 +175,22 @@ gtk_arrow_get_property (GObject *object,
|
||||
static void
|
||||
gtk_arrow_init (GtkArrow *arrow)
|
||||
{
|
||||
GtkArrowPriv *priv;
|
||||
gint xpad, ypad;
|
||||
|
||||
arrow->priv = G_TYPE_INSTANCE_GET_PRIVATE (arrow,
|
||||
GTK_TYPE_ARROW,
|
||||
GtkArrowPriv);
|
||||
priv = arrow->priv;
|
||||
|
||||
gtk_widget_set_has_window (GTK_WIDGET (arrow), FALSE);
|
||||
|
||||
GTK_WIDGET (arrow)->requisition.width = MIN_ARROW_SIZE + GTK_MISC (arrow)->xpad * 2;
|
||||
GTK_WIDGET (arrow)->requisition.height = MIN_ARROW_SIZE + GTK_MISC (arrow)->ypad * 2;
|
||||
gtk_misc_get_padding (GTK_MISC (arrow), &xpad, &ypad);
|
||||
GTK_WIDGET (arrow)->requisition.width = MIN_ARROW_SIZE + xpad * 2;
|
||||
GTK_WIDGET (arrow)->requisition.height = MIN_ARROW_SIZE + ypad * 2;
|
||||
|
||||
arrow->arrow_type = GTK_ARROW_RIGHT;
|
||||
arrow->shadow_type = GTK_SHADOW_OUT;
|
||||
priv->arrow_type = GTK_ARROW_RIGHT;
|
||||
priv->shadow_type = GTK_SHADOW_OUT;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -187,12 +206,15 @@ GtkWidget*
|
||||
gtk_arrow_new (GtkArrowType arrow_type,
|
||||
GtkShadowType shadow_type)
|
||||
{
|
||||
GtkArrowPriv *priv;
|
||||
GtkArrow *arrow;
|
||||
|
||||
arrow = g_object_new (GTK_TYPE_ARROW, NULL);
|
||||
|
||||
arrow->arrow_type = arrow_type;
|
||||
arrow->shadow_type = shadow_type;
|
||||
priv = arrow->priv;
|
||||
|
||||
priv->arrow_type = arrow_type;
|
||||
priv->shadow_type = shadow_type;
|
||||
|
||||
return GTK_WIDGET (arrow);
|
||||
}
|
||||
@@ -210,24 +232,27 @@ gtk_arrow_set (GtkArrow *arrow,
|
||||
GtkArrowType arrow_type,
|
||||
GtkShadowType shadow_type)
|
||||
{
|
||||
GtkArrowPriv *priv;
|
||||
GtkWidget *widget;
|
||||
|
||||
g_return_if_fail (GTK_IS_ARROW (arrow));
|
||||
|
||||
if ( ((GtkArrowType) arrow->arrow_type != arrow_type)
|
||||
|| ((GtkShadowType) arrow->shadow_type != shadow_type))
|
||||
priv = arrow->priv;
|
||||
|
||||
if (priv->arrow_type != arrow_type
|
||||
|| priv->shadow_type != shadow_type)
|
||||
{
|
||||
g_object_freeze_notify (G_OBJECT (arrow));
|
||||
|
||||
if ((GtkArrowType) arrow->arrow_type != arrow_type)
|
||||
if ((GtkArrowType) priv->arrow_type != arrow_type)
|
||||
{
|
||||
arrow->arrow_type = arrow_type;
|
||||
priv->arrow_type = arrow_type;
|
||||
g_object_notify (G_OBJECT (arrow), "arrow-type");
|
||||
}
|
||||
|
||||
if ((GtkShadowType) arrow->shadow_type != shadow_type)
|
||||
if (priv->shadow_type != shadow_type)
|
||||
{
|
||||
arrow->shadow_type = shadow_type;
|
||||
priv->shadow_type = shadow_type;
|
||||
g_object_notify (G_OBJECT (arrow), "shadow-type");
|
||||
}
|
||||
|
||||
@@ -247,39 +272,42 @@ gtk_arrow_expose (GtkWidget *widget,
|
||||
if (gtk_widget_is_drawable (widget))
|
||||
{
|
||||
GtkArrow *arrow = GTK_ARROW (widget);
|
||||
GtkArrowPriv *priv = arrow->priv;
|
||||
GtkMisc *misc = GTK_MISC (widget);
|
||||
GtkShadowType shadow_type;
|
||||
gint width, height;
|
||||
gint x, y;
|
||||
gint extent;
|
||||
gfloat xalign;
|
||||
gint xpad, ypad;
|
||||
gfloat xalign, yalign;
|
||||
GtkArrowType effective_arrow_type;
|
||||
gfloat arrow_scaling;
|
||||
|
||||
gtk_widget_style_get (widget, "arrow-scaling", &arrow_scaling, NULL);
|
||||
|
||||
width = widget->allocation.width - misc->xpad * 2;
|
||||
height = widget->allocation.height - misc->ypad * 2;
|
||||
extent = MIN (width, height) * arrow_scaling;
|
||||
effective_arrow_type = arrow->arrow_type;
|
||||
gtk_misc_get_padding (misc, &xpad, &ypad);
|
||||
gtk_misc_get_alignment (misc, &xalign, &yalign);
|
||||
|
||||
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
|
||||
xalign = misc->xalign;
|
||||
else
|
||||
{
|
||||
xalign = 1.0 - misc->xalign;
|
||||
if (arrow->arrow_type == GTK_ARROW_LEFT)
|
||||
width = widget->allocation.width - xpad * 2;
|
||||
height = widget->allocation.height - ypad * 2;
|
||||
extent = MIN (width, height) * arrow_scaling;
|
||||
effective_arrow_type = priv->arrow_type;
|
||||
|
||||
if (gtk_widget_get_direction (widget) != GTK_TEXT_DIR_LTR)
|
||||
{
|
||||
xalign = 1.0 - xalign;
|
||||
if (priv->arrow_type == GTK_ARROW_LEFT)
|
||||
effective_arrow_type = GTK_ARROW_RIGHT;
|
||||
else if (arrow->arrow_type == GTK_ARROW_RIGHT)
|
||||
else if (priv->arrow_type == GTK_ARROW_RIGHT)
|
||||
effective_arrow_type = GTK_ARROW_LEFT;
|
||||
}
|
||||
|
||||
x = floor (widget->allocation.x + misc->xpad
|
||||
x = floor (widget->allocation.x + xpad
|
||||
+ ((widget->allocation.width - extent) * xalign));
|
||||
y = floor (widget->allocation.y + misc->ypad
|
||||
+ ((widget->allocation.height - extent) * misc->yalign));
|
||||
y = floor (widget->allocation.y + ypad
|
||||
+ ((widget->allocation.height - extent) * yalign));
|
||||
|
||||
shadow_type = arrow->shadow_type;
|
||||
shadow_type = priv->shadow_type;
|
||||
|
||||
if (widget->state == GTK_STATE_ACTIVE)
|
||||
{
|
||||
|
||||
@@ -45,16 +45,16 @@ G_BEGIN_DECLS
|
||||
#define GTK_IS_ARROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ARROW))
|
||||
#define GTK_ARROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ARROW, GtkArrowClass))
|
||||
|
||||
|
||||
typedef struct _GtkArrow GtkArrow;
|
||||
typedef struct _GtkArrowClass GtkArrowClass;
|
||||
typedef struct _GtkArrow GtkArrow;
|
||||
typedef struct _GtkArrowPriv GtkArrowPriv;
|
||||
typedef struct _GtkArrowClass GtkArrowClass;
|
||||
|
||||
struct _GtkArrow
|
||||
{
|
||||
GtkMisc misc;
|
||||
|
||||
gint16 GSEAL (arrow_type);
|
||||
gint16 GSEAL (shadow_type);
|
||||
/*< private >*/
|
||||
GtkArrowPriv *priv;
|
||||
};
|
||||
|
||||
struct _GtkArrowClass
|
||||
|
||||
@@ -49,6 +49,18 @@
|
||||
#include "gtkintl.h"
|
||||
|
||||
|
||||
|
||||
struct _GtkAspectFramePriv
|
||||
{
|
||||
GtkAllocation center_allocation;
|
||||
|
||||
gboolean obey_child;
|
||||
gfloat xalign;
|
||||
gfloat yalign;
|
||||
gfloat ratio;
|
||||
};
|
||||
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_XALIGN,
|
||||
@@ -115,15 +127,24 @@ gtk_aspect_frame_class_init (GtkAspectFrameClass *class)
|
||||
P_("Force aspect ratio to match that of the frame's child"),
|
||||
TRUE,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
g_type_class_add_private (class, sizeof (GtkAspectFramePriv));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_aspect_frame_init (GtkAspectFrame *aspect_frame)
|
||||
{
|
||||
aspect_frame->xalign = 0.5;
|
||||
aspect_frame->yalign = 0.5;
|
||||
aspect_frame->ratio = 1.0;
|
||||
aspect_frame->obey_child = TRUE;
|
||||
GtkAspectFramePriv *priv;
|
||||
|
||||
aspect_frame->priv = G_TYPE_INSTANCE_GET_PRIVATE (aspect_frame,
|
||||
GTK_TYPE_ASPECT_FRAME,
|
||||
GtkAspectFramePriv);
|
||||
priv = aspect_frame->priv;
|
||||
|
||||
priv->xalign = 0.5;
|
||||
priv->yalign = 0.5;
|
||||
priv->ratio = 1.0;
|
||||
priv->obey_child = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -133,6 +154,7 @@ gtk_aspect_frame_set_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkAspectFrame *aspect_frame = GTK_ASPECT_FRAME (object);
|
||||
GtkAspectFramePriv *priv = aspect_frame->priv;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
@@ -140,29 +162,29 @@ gtk_aspect_frame_set_property (GObject *object,
|
||||
case PROP_XALIGN:
|
||||
gtk_aspect_frame_set (aspect_frame,
|
||||
g_value_get_float (value),
|
||||
aspect_frame->yalign,
|
||||
aspect_frame->ratio,
|
||||
aspect_frame->obey_child);
|
||||
priv->yalign,
|
||||
priv->ratio,
|
||||
priv->obey_child);
|
||||
break;
|
||||
case PROP_YALIGN:
|
||||
gtk_aspect_frame_set (aspect_frame,
|
||||
aspect_frame->xalign,
|
||||
priv->xalign,
|
||||
g_value_get_float (value),
|
||||
aspect_frame->ratio,
|
||||
aspect_frame->obey_child);
|
||||
priv->ratio,
|
||||
priv->obey_child);
|
||||
break;
|
||||
case PROP_RATIO:
|
||||
gtk_aspect_frame_set (aspect_frame,
|
||||
aspect_frame->xalign,
|
||||
aspect_frame->yalign,
|
||||
priv->xalign,
|
||||
priv->yalign,
|
||||
g_value_get_float (value),
|
||||
aspect_frame->obey_child);
|
||||
priv->obey_child);
|
||||
break;
|
||||
case PROP_OBEY_CHILD:
|
||||
gtk_aspect_frame_set (aspect_frame,
|
||||
aspect_frame->xalign,
|
||||
aspect_frame->yalign,
|
||||
aspect_frame->ratio,
|
||||
priv->xalign,
|
||||
priv->yalign,
|
||||
priv->ratio,
|
||||
g_value_get_boolean (value));
|
||||
break;
|
||||
default:
|
||||
@@ -178,20 +200,21 @@ gtk_aspect_frame_get_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkAspectFrame *aspect_frame = GTK_ASPECT_FRAME (object);
|
||||
GtkAspectFramePriv *priv = aspect_frame->priv;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_XALIGN:
|
||||
g_value_set_float (value, aspect_frame->xalign);
|
||||
g_value_set_float (value, priv->xalign);
|
||||
break;
|
||||
case PROP_YALIGN:
|
||||
g_value_set_float (value, aspect_frame->yalign);
|
||||
g_value_set_float (value, priv->yalign);
|
||||
break;
|
||||
case PROP_RATIO:
|
||||
g_value_set_float (value, aspect_frame->ratio);
|
||||
g_value_set_float (value, priv->ratio);
|
||||
break;
|
||||
case PROP_OBEY_CHILD:
|
||||
g_value_set_boolean (value, aspect_frame->obey_child);
|
||||
g_value_set_boolean (value, priv->obey_child);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
@@ -224,13 +247,16 @@ gtk_aspect_frame_new (const gchar *label,
|
||||
gboolean obey_child)
|
||||
{
|
||||
GtkAspectFrame *aspect_frame;
|
||||
GtkAspectFramePriv *priv;
|
||||
|
||||
aspect_frame = g_object_new (GTK_TYPE_ASPECT_FRAME, NULL);
|
||||
|
||||
aspect_frame->xalign = CLAMP (xalign, 0.0, 1.0);
|
||||
aspect_frame->yalign = CLAMP (yalign, 0.0, 1.0);
|
||||
aspect_frame->ratio = CLAMP (ratio, MIN_RATIO, MAX_RATIO);
|
||||
aspect_frame->obey_child = obey_child != FALSE;
|
||||
priv = aspect_frame->priv;
|
||||
|
||||
priv->xalign = CLAMP (xalign, 0.0, 1.0);
|
||||
priv->yalign = CLAMP (yalign, 0.0, 1.0);
|
||||
priv->ratio = CLAMP (ratio, MIN_RATIO, MAX_RATIO);
|
||||
priv->obey_child = obey_child != FALSE;
|
||||
|
||||
gtk_frame_set_label (GTK_FRAME(aspect_frame), label);
|
||||
|
||||
@@ -259,38 +285,42 @@ gtk_aspect_frame_set (GtkAspectFrame *aspect_frame,
|
||||
gfloat ratio,
|
||||
gboolean obey_child)
|
||||
{
|
||||
GtkAspectFramePriv *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_ASPECT_FRAME (aspect_frame));
|
||||
|
||||
priv = aspect_frame->priv;
|
||||
|
||||
xalign = CLAMP (xalign, 0.0, 1.0);
|
||||
yalign = CLAMP (yalign, 0.0, 1.0);
|
||||
ratio = CLAMP (ratio, MIN_RATIO, MAX_RATIO);
|
||||
obey_child = obey_child != FALSE;
|
||||
|
||||
if ( (aspect_frame->xalign != xalign)
|
||||
|| (aspect_frame->yalign != yalign)
|
||||
|| (aspect_frame->ratio != ratio)
|
||||
|| (aspect_frame->obey_child != obey_child))
|
||||
if (priv->xalign != xalign
|
||||
|| priv->yalign != yalign
|
||||
|| priv->ratio != ratio
|
||||
|| priv->obey_child != obey_child)
|
||||
{
|
||||
g_object_freeze_notify (G_OBJECT (aspect_frame));
|
||||
|
||||
if (aspect_frame->xalign != xalign)
|
||||
if (priv->xalign != xalign)
|
||||
{
|
||||
aspect_frame->xalign = xalign;
|
||||
priv->xalign = xalign;
|
||||
g_object_notify (G_OBJECT (aspect_frame), "xalign");
|
||||
}
|
||||
if (aspect_frame->yalign != yalign)
|
||||
if (priv->yalign != yalign)
|
||||
{
|
||||
aspect_frame->yalign = yalign;
|
||||
priv->yalign = yalign;
|
||||
g_object_notify (G_OBJECT (aspect_frame), "yalign");
|
||||
}
|
||||
if (aspect_frame->ratio != ratio)
|
||||
if (priv->ratio != ratio)
|
||||
{
|
||||
aspect_frame->ratio = ratio;
|
||||
priv->ratio = ratio;
|
||||
g_object_notify (G_OBJECT (aspect_frame), "ratio");
|
||||
}
|
||||
if (aspect_frame->obey_child != obey_child)
|
||||
if (priv->obey_child != obey_child)
|
||||
{
|
||||
aspect_frame->obey_child = obey_child;
|
||||
priv->obey_child = obey_child;
|
||||
g_object_notify (G_OBJECT (aspect_frame), "obey-child");
|
||||
}
|
||||
g_object_thaw_notify (G_OBJECT (aspect_frame));
|
||||
@@ -304,18 +334,21 @@ gtk_aspect_frame_compute_child_allocation (GtkFrame *frame,
|
||||
GtkAllocation *child_allocation)
|
||||
{
|
||||
GtkAspectFrame *aspect_frame = GTK_ASPECT_FRAME (frame);
|
||||
GtkAspectFramePriv *priv = aspect_frame->priv;
|
||||
GtkBin *bin = GTK_BIN (frame);
|
||||
GtkWidget *child;
|
||||
gdouble ratio;
|
||||
|
||||
if (bin->child && gtk_widget_get_visible (bin->child))
|
||||
child = gtk_bin_get_child (bin);
|
||||
if (child && gtk_widget_get_visible (child))
|
||||
{
|
||||
GtkAllocation full_allocation;
|
||||
|
||||
if (aspect_frame->obey_child)
|
||||
if (priv->obey_child)
|
||||
{
|
||||
GtkRequisition child_requisition;
|
||||
|
||||
gtk_widget_get_child_requisition (bin->child, &child_requisition);
|
||||
gtk_widget_get_child_requisition (child, &child_requisition);
|
||||
if (child_requisition.height != 0)
|
||||
{
|
||||
ratio = ((gdouble) child_requisition.width /
|
||||
@@ -329,7 +362,7 @@ gtk_aspect_frame_compute_child_allocation (GtkFrame *frame,
|
||||
ratio = 1.0;
|
||||
}
|
||||
else
|
||||
ratio = aspect_frame->ratio;
|
||||
ratio = priv->ratio;
|
||||
|
||||
GTK_FRAME_CLASS (gtk_aspect_frame_parent_class)->compute_child_allocation (frame, &full_allocation);
|
||||
|
||||
@@ -344,8 +377,8 @@ gtk_aspect_frame_compute_child_allocation (GtkFrame *frame,
|
||||
child_allocation->height = full_allocation.height;
|
||||
}
|
||||
|
||||
child_allocation->x = full_allocation.x + aspect_frame->xalign * (full_allocation.width - child_allocation->width);
|
||||
child_allocation->y = full_allocation.y + aspect_frame->yalign * (full_allocation.height - child_allocation->height);
|
||||
child_allocation->x = full_allocation.x + priv->xalign * (full_allocation.width - child_allocation->width);
|
||||
child_allocation->y = full_allocation.y + priv->yalign * (full_allocation.height - child_allocation->height);
|
||||
}
|
||||
else
|
||||
GTK_FRAME_CLASS (gtk_aspect_frame_parent_class)->compute_child_allocation (frame, child_allocation);
|
||||
|
||||
@@ -44,20 +44,16 @@ G_BEGIN_DECLS
|
||||
#define GTK_IS_ASPECT_FRAME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ASPECT_FRAME))
|
||||
#define GTK_ASPECT_FRAME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ASPECT_FRAME, GtkAspectFrameClass))
|
||||
|
||||
|
||||
typedef struct _GtkAspectFrame GtkAspectFrame;
|
||||
typedef struct _GtkAspectFramePriv GtkAspectFramePriv;
|
||||
typedef struct _GtkAspectFrameClass GtkAspectFrameClass;
|
||||
|
||||
struct _GtkAspectFrame
|
||||
{
|
||||
GtkFrame frame;
|
||||
|
||||
gfloat GSEAL (xalign);
|
||||
gfloat GSEAL (yalign);
|
||||
gfloat GSEAL (ratio);
|
||||
gboolean GSEAL (obey_child);
|
||||
|
||||
GtkAllocation GSEAL (center_allocation);
|
||||
/*< private >*/
|
||||
GtkAspectFramePriv *priv;
|
||||
};
|
||||
|
||||
struct _GtkAspectFrameClass
|
||||
|
||||
@@ -64,7 +64,6 @@
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkbuildable.h"
|
||||
|
||||
#define GTK_ASSISTANT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GTK_TYPE_ASSISTANT, GtkAssistantPrivate))
|
||||
|
||||
#define HEADER_SPACING 12
|
||||
#define ACTION_AREA_SPACING 12
|
||||
@@ -85,6 +84,13 @@ struct _GtkAssistantPage
|
||||
|
||||
struct _GtkAssistantPrivate
|
||||
{
|
||||
GtkWidget *cancel;
|
||||
GtkWidget *forward;
|
||||
GtkWidget *back;
|
||||
GtkWidget *apply;
|
||||
GtkWidget *close;
|
||||
GtkWidget *last;
|
||||
|
||||
GtkWidget *header_image;
|
||||
GtkWidget *sidebar_image;
|
||||
|
||||
@@ -464,12 +470,12 @@ compute_last_button_state (GtkAssistant *assistant)
|
||||
(page_info->type == GTK_ASSISTANT_PAGE_CONFIRM ||
|
||||
page_info->type == GTK_ASSISTANT_PAGE_SUMMARY))
|
||||
{
|
||||
gtk_widget_show (assistant->last);
|
||||
gtk_widget_set_sensitive (assistant->last,
|
||||
gtk_widget_show (priv->last);
|
||||
gtk_widget_set_sensitive (priv->last,
|
||||
current_page_info->complete);
|
||||
}
|
||||
else
|
||||
gtk_widget_hide (assistant->last);
|
||||
gtk_widget_hide (priv->last);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -484,9 +490,9 @@ compute_progress_state (GtkAssistant *assistant)
|
||||
page_num = (priv->forward_function) (page_num, priv->forward_function_data);
|
||||
|
||||
if (page_num >= 0 && page_num < n_pages)
|
||||
gtk_widget_show (assistant->forward);
|
||||
gtk_widget_show (priv->forward);
|
||||
else
|
||||
gtk_widget_hide (assistant->forward);
|
||||
gtk_widget_hide (priv->forward);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -523,55 +529,55 @@ set_assistant_buttons_state (GtkAssistant *assistant)
|
||||
switch (priv->current_page->type)
|
||||
{
|
||||
case GTK_ASSISTANT_PAGE_INTRO:
|
||||
gtk_widget_set_sensitive (assistant->cancel, TRUE);
|
||||
gtk_widget_set_sensitive (assistant->forward, priv->current_page->complete);
|
||||
gtk_widget_grab_default (assistant->forward);
|
||||
gtk_widget_show (assistant->forward);
|
||||
gtk_widget_hide (assistant->back);
|
||||
gtk_widget_hide (assistant->apply);
|
||||
gtk_widget_hide (assistant->close);
|
||||
gtk_widget_set_sensitive (priv->cancel, TRUE);
|
||||
gtk_widget_set_sensitive (priv->forward, priv->current_page->complete);
|
||||
gtk_widget_grab_default (priv->forward);
|
||||
gtk_widget_show (priv->forward);
|
||||
gtk_widget_hide (priv->back);
|
||||
gtk_widget_hide (priv->apply);
|
||||
gtk_widget_hide (priv->close);
|
||||
compute_last_button_state (assistant);
|
||||
break;
|
||||
case GTK_ASSISTANT_PAGE_CONFIRM:
|
||||
gtk_widget_set_sensitive (assistant->cancel, TRUE);
|
||||
gtk_widget_set_sensitive (assistant->back, TRUE);
|
||||
gtk_widget_set_sensitive (assistant->apply, priv->current_page->complete);
|
||||
gtk_widget_grab_default (assistant->apply);
|
||||
gtk_widget_show (assistant->back);
|
||||
gtk_widget_show (assistant->apply);
|
||||
gtk_widget_hide (assistant->forward);
|
||||
gtk_widget_hide (assistant->close);
|
||||
gtk_widget_hide (assistant->last);
|
||||
gtk_widget_set_sensitive (priv->cancel, TRUE);
|
||||
gtk_widget_set_sensitive (priv->back, TRUE);
|
||||
gtk_widget_set_sensitive (priv->apply, priv->current_page->complete);
|
||||
gtk_widget_grab_default (priv->apply);
|
||||
gtk_widget_show (priv->back);
|
||||
gtk_widget_show (priv->apply);
|
||||
gtk_widget_hide (priv->forward);
|
||||
gtk_widget_hide (priv->close);
|
||||
gtk_widget_hide (priv->last);
|
||||
break;
|
||||
case GTK_ASSISTANT_PAGE_CONTENT:
|
||||
gtk_widget_set_sensitive (assistant->cancel, TRUE);
|
||||
gtk_widget_set_sensitive (assistant->back, TRUE);
|
||||
gtk_widget_set_sensitive (assistant->forward, priv->current_page->complete);
|
||||
gtk_widget_grab_default (assistant->forward);
|
||||
gtk_widget_show (assistant->back);
|
||||
gtk_widget_show (assistant->forward);
|
||||
gtk_widget_hide (assistant->apply);
|
||||
gtk_widget_hide (assistant->close);
|
||||
gtk_widget_set_sensitive (priv->cancel, TRUE);
|
||||
gtk_widget_set_sensitive (priv->back, TRUE);
|
||||
gtk_widget_set_sensitive (priv->forward, priv->current_page->complete);
|
||||
gtk_widget_grab_default (priv->forward);
|
||||
gtk_widget_show (priv->back);
|
||||
gtk_widget_show (priv->forward);
|
||||
gtk_widget_hide (priv->apply);
|
||||
gtk_widget_hide (priv->close);
|
||||
compute_last_button_state (assistant);
|
||||
break;
|
||||
case GTK_ASSISTANT_PAGE_SUMMARY:
|
||||
gtk_widget_set_sensitive (assistant->close, priv->current_page->complete);
|
||||
gtk_widget_grab_default (assistant->close);
|
||||
gtk_widget_show (assistant->close);
|
||||
gtk_widget_hide (assistant->back);
|
||||
gtk_widget_hide (assistant->forward);
|
||||
gtk_widget_hide (assistant->apply);
|
||||
gtk_widget_hide (assistant->last);
|
||||
gtk_widget_set_sensitive (priv->close, priv->current_page->complete);
|
||||
gtk_widget_grab_default (priv->close);
|
||||
gtk_widget_show (priv->close);
|
||||
gtk_widget_hide (priv->back);
|
||||
gtk_widget_hide (priv->forward);
|
||||
gtk_widget_hide (priv->apply);
|
||||
gtk_widget_hide (priv->last);
|
||||
break;
|
||||
case GTK_ASSISTANT_PAGE_PROGRESS:
|
||||
gtk_widget_set_sensitive (assistant->cancel, priv->current_page->complete);
|
||||
gtk_widget_set_sensitive (assistant->back, priv->current_page->complete);
|
||||
gtk_widget_set_sensitive (assistant->forward, priv->current_page->complete);
|
||||
gtk_widget_grab_default (assistant->forward);
|
||||
gtk_widget_show (assistant->back);
|
||||
gtk_widget_hide (assistant->apply);
|
||||
gtk_widget_hide (assistant->close);
|
||||
gtk_widget_hide (assistant->last);
|
||||
gtk_widget_set_sensitive (priv->cancel, priv->current_page->complete);
|
||||
gtk_widget_set_sensitive (priv->back, priv->current_page->complete);
|
||||
gtk_widget_set_sensitive (priv->forward, priv->current_page->complete);
|
||||
gtk_widget_grab_default (priv->forward);
|
||||
gtk_widget_show (priv->back);
|
||||
gtk_widget_hide (priv->apply);
|
||||
gtk_widget_hide (priv->close);
|
||||
gtk_widget_hide (priv->last);
|
||||
compute_progress_state (assistant);
|
||||
break;
|
||||
default:
|
||||
@@ -579,16 +585,16 @@ set_assistant_buttons_state (GtkAssistant *assistant)
|
||||
}
|
||||
|
||||
if (priv->committed)
|
||||
gtk_widget_hide (assistant->cancel);
|
||||
gtk_widget_hide (priv->cancel);
|
||||
else if (priv->current_page->type == GTK_ASSISTANT_PAGE_SUMMARY)
|
||||
gtk_widget_hide (assistant->cancel);
|
||||
gtk_widget_hide (priv->cancel);
|
||||
else
|
||||
gtk_widget_show (assistant->cancel);
|
||||
gtk_widget_show (priv->cancel);
|
||||
|
||||
/* this is quite general, we don't want to
|
||||
* go back if it's the first page */
|
||||
if (!priv->visited_pages)
|
||||
gtk_widget_hide (assistant->back);
|
||||
gtk_widget_hide (priv->back);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -632,12 +638,12 @@ set_current_page (GtkAssistant *assistant,
|
||||
gint i;
|
||||
|
||||
/* find the best button to focus */
|
||||
button[0] = assistant->apply;
|
||||
button[1] = assistant->close;
|
||||
button[2] = assistant->forward;
|
||||
button[3] = assistant->back;
|
||||
button[4] = assistant->cancel;
|
||||
button[5] = assistant->last;
|
||||
button[0] = priv->apply;
|
||||
button[1] = priv->close;
|
||||
button[2] = priv->forward;
|
||||
button[3] = priv->back;
|
||||
button[4] = priv->cancel;
|
||||
button[5] = priv->last;
|
||||
for (i = 0; i < 6; i++)
|
||||
{
|
||||
if (gtk_widget_get_visible (button[i]) && gtk_widget_get_sensitive (button[i]))
|
||||
@@ -773,7 +779,10 @@ gtk_assistant_init (GtkAssistant *assistant)
|
||||
{
|
||||
GtkAssistantPrivate *priv;
|
||||
|
||||
priv = assistant->priv = GTK_ASSISTANT_GET_PRIVATE (assistant);
|
||||
assistant->priv = G_TYPE_INSTANCE_GET_PRIVATE (assistant,
|
||||
GTK_TYPE_ASSISTANT,
|
||||
GtkAssistantPrivate);
|
||||
priv = assistant->priv;
|
||||
|
||||
gtk_container_set_reallocate_redraws (GTK_CONTAINER (assistant), TRUE);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (assistant), 12);
|
||||
@@ -795,47 +804,47 @@ gtk_assistant_init (GtkAssistant *assistant)
|
||||
/* Action area */
|
||||
priv->action_area = gtk_hbox_new (FALSE, 6);
|
||||
|
||||
assistant->close = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
|
||||
assistant->apply = gtk_button_new_from_stock (GTK_STOCK_APPLY);
|
||||
assistant->forward = gtk_button_new_from_stock (GTK_STOCK_GO_FORWARD);
|
||||
assistant->back = gtk_button_new_from_stock (GTK_STOCK_GO_BACK);
|
||||
assistant->cancel = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
|
||||
assistant->last = gtk_button_new_from_stock (GTK_STOCK_GOTO_LAST);
|
||||
gtk_widget_set_can_default (assistant->close, TRUE);
|
||||
gtk_widget_set_can_default (assistant->apply, TRUE);
|
||||
gtk_widget_set_can_default (assistant->forward, TRUE);
|
||||
priv->close = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
|
||||
priv->apply = gtk_button_new_from_stock (GTK_STOCK_APPLY);
|
||||
priv->forward = gtk_button_new_from_stock (GTK_STOCK_GO_FORWARD);
|
||||
priv->back = gtk_button_new_from_stock (GTK_STOCK_GO_BACK);
|
||||
priv->cancel = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
|
||||
priv->last = gtk_button_new_from_stock (GTK_STOCK_GOTO_LAST);
|
||||
gtk_widget_set_can_default (priv->close, TRUE);
|
||||
gtk_widget_set_can_default (priv->apply, TRUE);
|
||||
gtk_widget_set_can_default (priv->forward, TRUE);
|
||||
|
||||
priv->size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
||||
gtk_size_group_add_widget (priv->size_group, assistant->close);
|
||||
gtk_size_group_add_widget (priv->size_group, assistant->apply);
|
||||
gtk_size_group_add_widget (priv->size_group, assistant->forward);
|
||||
gtk_size_group_add_widget (priv->size_group, assistant->back);
|
||||
gtk_size_group_add_widget (priv->size_group, assistant->cancel);
|
||||
gtk_size_group_add_widget (priv->size_group, assistant->last);
|
||||
gtk_size_group_add_widget (priv->size_group, priv->close);
|
||||
gtk_size_group_add_widget (priv->size_group, priv->apply);
|
||||
gtk_size_group_add_widget (priv->size_group, priv->forward);
|
||||
gtk_size_group_add_widget (priv->size_group, priv->back);
|
||||
gtk_size_group_add_widget (priv->size_group, priv->cancel);
|
||||
gtk_size_group_add_widget (priv->size_group, priv->last);
|
||||
|
||||
if (!alternative_button_order (assistant))
|
||||
{
|
||||
gtk_box_pack_end (GTK_BOX (priv->action_area), assistant->apply, FALSE, FALSE, 0);
|
||||
gtk_box_pack_end (GTK_BOX (priv->action_area), assistant->forward, FALSE, FALSE, 0);
|
||||
gtk_box_pack_end (GTK_BOX (priv->action_area), assistant->back, FALSE, FALSE, 0);
|
||||
gtk_box_pack_end (GTK_BOX (priv->action_area), assistant->last, FALSE, FALSE, 0);
|
||||
gtk_box_pack_end (GTK_BOX (priv->action_area), assistant->cancel, FALSE, FALSE, 0);
|
||||
gtk_box_pack_end (GTK_BOX (priv->action_area), assistant->close, FALSE, FALSE, 0);
|
||||
gtk_box_pack_end (GTK_BOX (priv->action_area), priv->apply, FALSE, FALSE, 0);
|
||||
gtk_box_pack_end (GTK_BOX (priv->action_area), priv->forward, FALSE, FALSE, 0);
|
||||
gtk_box_pack_end (GTK_BOX (priv->action_area), priv->back, FALSE, FALSE, 0);
|
||||
gtk_box_pack_end (GTK_BOX (priv->action_area), priv->last, FALSE, FALSE, 0);
|
||||
gtk_box_pack_end (GTK_BOX (priv->action_area), priv->cancel, FALSE, FALSE, 0);
|
||||
gtk_box_pack_end (GTK_BOX (priv->action_area), priv->close, FALSE, FALSE, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_box_pack_end (GTK_BOX (priv->action_area), assistant->close, FALSE, FALSE, 0);
|
||||
gtk_box_pack_end (GTK_BOX (priv->action_area), assistant->cancel, FALSE, FALSE, 0);
|
||||
gtk_box_pack_end (GTK_BOX (priv->action_area), assistant->apply, FALSE, FALSE, 0);
|
||||
gtk_box_pack_end (GTK_BOX (priv->action_area), assistant->forward, FALSE, FALSE, 0);
|
||||
gtk_box_pack_end (GTK_BOX (priv->action_area), assistant->back, FALSE, FALSE, 0);
|
||||
gtk_box_pack_end (GTK_BOX (priv->action_area), assistant->last, FALSE, FALSE, 0);
|
||||
gtk_box_pack_end (GTK_BOX (priv->action_area), priv->close, FALSE, FALSE, 0);
|
||||
gtk_box_pack_end (GTK_BOX (priv->action_area), priv->cancel, FALSE, FALSE, 0);
|
||||
gtk_box_pack_end (GTK_BOX (priv->action_area), priv->apply, FALSE, FALSE, 0);
|
||||
gtk_box_pack_end (GTK_BOX (priv->action_area), priv->forward, FALSE, FALSE, 0);
|
||||
gtk_box_pack_end (GTK_BOX (priv->action_area), priv->back, FALSE, FALSE, 0);
|
||||
gtk_box_pack_end (GTK_BOX (priv->action_area), priv->last, FALSE, FALSE, 0);
|
||||
}
|
||||
|
||||
gtk_widget_set_parent (priv->action_area, GTK_WIDGET (assistant));
|
||||
gtk_widget_show (assistant->forward);
|
||||
gtk_widget_show (assistant->back);
|
||||
gtk_widget_show (assistant->cancel);
|
||||
gtk_widget_show (priv->forward);
|
||||
gtk_widget_show (priv->back);
|
||||
gtk_widget_show (priv->cancel);
|
||||
gtk_widget_show (priv->action_area);
|
||||
|
||||
gtk_widget_pop_composite_child ();
|
||||
@@ -848,17 +857,17 @@ gtk_assistant_init (GtkAssistant *assistant)
|
||||
priv->forward_function_data = assistant;
|
||||
priv->forward_data_destroy = NULL;
|
||||
|
||||
g_signal_connect (G_OBJECT (assistant->close), "clicked",
|
||||
g_signal_connect (G_OBJECT (priv->close), "clicked",
|
||||
G_CALLBACK (on_assistant_close), assistant);
|
||||
g_signal_connect (G_OBJECT (assistant->apply), "clicked",
|
||||
g_signal_connect (G_OBJECT (priv->apply), "clicked",
|
||||
G_CALLBACK (on_assistant_apply), assistant);
|
||||
g_signal_connect (G_OBJECT (assistant->forward), "clicked",
|
||||
g_signal_connect (G_OBJECT (priv->forward), "clicked",
|
||||
G_CALLBACK (on_assistant_forward), assistant);
|
||||
g_signal_connect (G_OBJECT (assistant->back), "clicked",
|
||||
g_signal_connect (G_OBJECT (priv->back), "clicked",
|
||||
G_CALLBACK (on_assistant_back), assistant);
|
||||
g_signal_connect (G_OBJECT (assistant->cancel), "clicked",
|
||||
g_signal_connect (G_OBJECT (priv->cancel), "clicked",
|
||||
G_CALLBACK (on_assistant_cancel), assistant);
|
||||
g_signal_connect (G_OBJECT (assistant->last), "clicked",
|
||||
g_signal_connect (G_OBJECT (priv->last), "clicked",
|
||||
G_CALLBACK (on_assistant_last), assistant);
|
||||
}
|
||||
|
||||
@@ -1131,6 +1140,7 @@ gtk_assistant_size_request (GtkWidget *widget,
|
||||
GtkRequisition child_requisition;
|
||||
gint header_padding, content_padding;
|
||||
gint width, height, header_width, header_height;
|
||||
guint border_width;
|
||||
GList *list;
|
||||
|
||||
gtk_widget_style_get (widget,
|
||||
@@ -1179,8 +1189,9 @@ gtk_assistant_size_request (GtkWidget *widget,
|
||||
width = MAX (width, child_requisition.width);
|
||||
height += child_requisition.height + ACTION_AREA_SPACING;
|
||||
|
||||
width += GTK_CONTAINER (widget)->border_width * 2 + content_padding * 2;
|
||||
height += GTK_CONTAINER (widget)->border_width * 2 + content_padding * 2;
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||
width += border_width * 2 + content_padding * 2;
|
||||
height += border_width * 2 + content_padding * 2;
|
||||
|
||||
requisition->width = width;
|
||||
requisition->height = height;
|
||||
@@ -1196,6 +1207,7 @@ gtk_assistant_size_allocate (GtkWidget *widget,
|
||||
GtkRequisition header_requisition, action_requisition, sidebar_requisition;
|
||||
GtkAllocation child_allocation, header_allocation;
|
||||
gint header_padding, content_padding;
|
||||
guint border_width;
|
||||
gboolean rtl;
|
||||
GList *pages;
|
||||
|
||||
@@ -1208,13 +1220,14 @@ gtk_assistant_size_allocate (GtkWidget *widget,
|
||||
NULL);
|
||||
|
||||
widget->allocation = *allocation;
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||
|
||||
/* Header */
|
||||
gtk_widget_get_child_requisition (priv->header_image, &header_requisition);
|
||||
|
||||
header_allocation.x = GTK_CONTAINER (widget)->border_width + header_padding;
|
||||
header_allocation.y = GTK_CONTAINER (widget)->border_width + header_padding;
|
||||
header_allocation.width = allocation->width - 2 * GTK_CONTAINER (widget)->border_width - 2 * header_padding;
|
||||
header_allocation.x = border_width + header_padding;
|
||||
header_allocation.y = border_width + header_padding;
|
||||
header_allocation.width = allocation->width - 2 * border_width - 2 * header_padding;
|
||||
header_allocation.height = header_requisition.height;
|
||||
|
||||
gtk_widget_size_allocate (priv->header_image, &header_allocation);
|
||||
@@ -1222,10 +1235,9 @@ gtk_assistant_size_allocate (GtkWidget *widget,
|
||||
/* Action area */
|
||||
gtk_widget_get_child_requisition (priv->action_area, &action_requisition);
|
||||
|
||||
child_allocation.x = GTK_CONTAINER (widget)->border_width;
|
||||
child_allocation.y = allocation->height -
|
||||
GTK_CONTAINER (widget)->border_width - action_requisition.height;
|
||||
child_allocation.width = allocation->width - 2 * GTK_CONTAINER (widget)->border_width;
|
||||
child_allocation.x = border_width;
|
||||
child_allocation.y = allocation->height - border_width - action_requisition.height;
|
||||
child_allocation.width = allocation->width - 2 * border_width;
|
||||
child_allocation.height = action_requisition.height;
|
||||
|
||||
gtk_widget_size_allocate (priv->action_area, &child_allocation);
|
||||
@@ -1234,25 +1246,23 @@ gtk_assistant_size_allocate (GtkWidget *widget,
|
||||
gtk_widget_get_child_requisition (priv->sidebar_image, &sidebar_requisition);
|
||||
|
||||
if (rtl)
|
||||
child_allocation.x = allocation->width -
|
||||
GTK_CONTAINER (widget)->border_width - sidebar_requisition.width;
|
||||
child_allocation.x = allocation->width - border_width - sidebar_requisition.width;
|
||||
else
|
||||
child_allocation.x = GTK_CONTAINER (widget)->border_width;
|
||||
child_allocation.x = border_width;
|
||||
|
||||
child_allocation.y = GTK_CONTAINER (widget)->border_width +
|
||||
priv->header_image->allocation.height + 2 * header_padding;
|
||||
child_allocation.y = border_width + priv->header_image->allocation.height + 2 * header_padding;
|
||||
child_allocation.width = sidebar_requisition.width;
|
||||
child_allocation.height = allocation->height - 2 * GTK_CONTAINER (widget)->border_width -
|
||||
child_allocation.height = allocation->height - 2 * border_width -
|
||||
priv->header_image->allocation.height - 2 * header_padding - priv->action_area->allocation.height;
|
||||
|
||||
gtk_widget_size_allocate (priv->sidebar_image, &child_allocation);
|
||||
|
||||
/* Pages */
|
||||
child_allocation.x = GTK_CONTAINER (widget)->border_width + content_padding;
|
||||
child_allocation.y = GTK_CONTAINER (widget)->border_width +
|
||||
child_allocation.x = border_width + content_padding;
|
||||
child_allocation.y = border_width +
|
||||
priv->header_image->allocation.height + 2 * header_padding + content_padding;
|
||||
child_allocation.width = allocation->width - 2 * GTK_CONTAINER (widget)->border_width - 2 * content_padding;
|
||||
child_allocation.height = allocation->height - 2 * GTK_CONTAINER (widget)->border_width -
|
||||
child_allocation.width = allocation->width - 2 * border_width - 2 * content_padding;
|
||||
child_allocation.height = allocation->height - 2 * border_width -
|
||||
priv->header_image->allocation.height - 2 * header_padding - ACTION_AREA_SPACING - priv->action_area->allocation.height - 2 * content_padding;
|
||||
|
||||
if (gtk_widget_get_visible (priv->sidebar_image))
|
||||
@@ -1443,7 +1453,7 @@ gtk_assistant_focus (GtkWidget *widget,
|
||||
priv = GTK_ASSISTANT (widget)->priv;
|
||||
|
||||
/* we only have to care about 2 widgets, action area and the current page */
|
||||
if (container->focus_child == priv->action_area)
|
||||
if (gtk_container_get_focus_child (container) == priv->action_area)
|
||||
{
|
||||
if (!gtk_widget_child_focus (priv->action_area, direction) &&
|
||||
(priv->current_page == NULL ||
|
||||
@@ -2322,7 +2332,7 @@ gtk_assistant_accessible_get_n_children (AtkObject *accessible)
|
||||
GtkAssistant *assistant;
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = GTK_ACCESSIBLE (accessible)->widget;
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
|
||||
|
||||
if (!widget)
|
||||
return 0;
|
||||
@@ -2344,7 +2354,7 @@ gtk_assistant_accessible_ref_child (AtkObject *accessible,
|
||||
AtkObject *obj;
|
||||
const gchar *title;
|
||||
|
||||
widget = GTK_ACCESSIBLE (accessible)->widget;
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
|
||||
if (!widget)
|
||||
return NULL;
|
||||
|
||||
|
||||
@@ -77,15 +77,8 @@ struct _GtkAssistant
|
||||
{
|
||||
GtkWindow parent;
|
||||
|
||||
GtkWidget *GSEAL (cancel);
|
||||
GtkWidget *GSEAL (forward);
|
||||
GtkWidget *GSEAL (back);
|
||||
GtkWidget *GSEAL (apply);
|
||||
GtkWidget *GSEAL (close);
|
||||
GtkWidget *GSEAL (last);
|
||||
|
||||
/*< private >*/
|
||||
GtkAssistantPrivate *GSEAL (priv);
|
||||
GtkAssistantPrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkAssistantClass
|
||||
|
||||
167
gtk/gtkbbox.c
167
gtk/gtkbbox.c
@@ -61,6 +61,16 @@
|
||||
#include "gtkintl.h"
|
||||
|
||||
|
||||
struct _GtkButtonBoxPriv
|
||||
{
|
||||
GtkButtonBoxStyle layout_style;
|
||||
|
||||
gint child_ipad_x;
|
||||
gint child_ipad_y;
|
||||
gint child_min_width;
|
||||
gint child_min_height;
|
||||
};
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_LAYOUT_STYLE
|
||||
@@ -175,17 +185,26 @@ gtk_button_box_class_init (GtkButtonBoxClass *class)
|
||||
P_("If TRUE, the child appears in a secondary group of children, suitable for, e.g., help buttons"),
|
||||
FALSE,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
g_type_class_add_private (class, sizeof (GtkButtonBoxPriv));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_button_box_init (GtkButtonBox *button_box)
|
||||
{
|
||||
GTK_BOX (button_box)->spacing = 0;
|
||||
button_box->child_min_width = GTK_BUTTONBOX_DEFAULT;
|
||||
button_box->child_min_height = GTK_BUTTONBOX_DEFAULT;
|
||||
button_box->child_ipad_x = GTK_BUTTONBOX_DEFAULT;
|
||||
button_box->child_ipad_y = GTK_BUTTONBOX_DEFAULT;
|
||||
button_box->layout_style = GTK_BUTTONBOX_DEFAULT_STYLE;
|
||||
GtkButtonBoxPriv *priv;
|
||||
|
||||
button_box->priv = G_TYPE_INSTANCE_GET_PRIVATE (button_box,
|
||||
GTK_TYPE_BUTTON_BOX,
|
||||
GtkButtonBoxPriv);
|
||||
priv = button_box->priv;
|
||||
|
||||
gtk_box_set_spacing (GTK_BOX (button_box), 0);
|
||||
priv->child_min_width = GTK_BUTTONBOX_DEFAULT;
|
||||
priv->child_min_height = GTK_BUTTONBOX_DEFAULT;
|
||||
priv->child_ipad_x = GTK_BUTTONBOX_DEFAULT;
|
||||
priv->child_ipad_y = GTK_BUTTONBOX_DEFAULT;
|
||||
priv->layout_style = GTK_BUTTONBOX_DEFAULT_STYLE;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -212,10 +231,12 @@ gtk_button_box_get_property (GObject *object,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkButtonBoxPriv *priv = GTK_BUTTON_BOX (object)->priv;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_LAYOUT_STYLE:
|
||||
g_value_set_enum (value, GTK_BUTTON_BOX (object)->layout_style);
|
||||
g_value_set_enum (value, priv->layout_style);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
@@ -273,13 +294,17 @@ void
|
||||
gtk_button_box_set_layout (GtkButtonBox *widget,
|
||||
GtkButtonBoxStyle layout_style)
|
||||
{
|
||||
GtkButtonBoxPriv *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_BUTTON_BOX (widget));
|
||||
g_return_if_fail (layout_style >= GTK_BUTTONBOX_DEFAULT_STYLE &&
|
||||
layout_style <= GTK_BUTTONBOX_CENTER);
|
||||
|
||||
if (widget->layout_style != layout_style)
|
||||
priv = widget->priv;
|
||||
|
||||
if (priv->layout_style != layout_style)
|
||||
{
|
||||
widget->layout_style = layout_style;
|
||||
priv->layout_style = layout_style;
|
||||
g_object_notify (G_OBJECT (widget), "layout-style");
|
||||
gtk_widget_queue_resize (GTK_WIDGET (widget));
|
||||
}
|
||||
@@ -298,7 +323,7 @@ gtk_button_box_get_layout (GtkButtonBox *widget)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_BUTTON_BOX (widget), GTK_BUTTONBOX_SPREAD);
|
||||
|
||||
return widget->layout_style;
|
||||
return widget->priv->layout_style;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -316,14 +341,14 @@ gboolean
|
||||
gtk_button_box_get_child_secondary (GtkButtonBox *widget,
|
||||
GtkWidget *child)
|
||||
{
|
||||
GList *list;
|
||||
GtkBoxChild *child_info;
|
||||
GtkBoxChild *child_info = NULL;
|
||||
GList *list, *children;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_BUTTON_BOX (widget), FALSE);
|
||||
g_return_val_if_fail (GTK_IS_WIDGET (child), FALSE);
|
||||
|
||||
child_info = NULL;
|
||||
list = GTK_BOX (widget)->children;
|
||||
list = children = gtk_container_get_children (GTK_CONTAINER (widget));
|
||||
|
||||
while (list)
|
||||
{
|
||||
child_info = list->data;
|
||||
@@ -333,9 +358,16 @@ gtk_button_box_get_child_secondary (GtkButtonBox *widget,
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
g_return_val_if_fail (list != NULL, FALSE);
|
||||
|
||||
return child_info->is_secondary;
|
||||
if (list == NULL)
|
||||
{
|
||||
g_list_free (children);
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_list_free (children);
|
||||
return child_info->is_secondary;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -363,13 +395,14 @@ gtk_button_box_set_child_secondary (GtkButtonBox *widget,
|
||||
GtkWidget *child,
|
||||
gboolean is_secondary)
|
||||
{
|
||||
GList *list;
|
||||
|
||||
GList *list, *children;
|
||||
|
||||
g_return_if_fail (GTK_IS_BUTTON_BOX (widget));
|
||||
g_return_if_fail (GTK_IS_WIDGET (child));
|
||||
g_return_if_fail (child->parent == GTK_WIDGET (widget));
|
||||
|
||||
list = GTK_BOX (widget)->children;
|
||||
|
||||
list = children = gtk_container_get_children (GTK_CONTAINER (widget));
|
||||
while (list)
|
||||
{
|
||||
GtkBoxChild *child_info = list->data;
|
||||
@@ -381,6 +414,7 @@ gtk_button_box_set_child_secondary (GtkButtonBox *widget,
|
||||
|
||||
list = list->next;
|
||||
}
|
||||
g_list_free (children);
|
||||
|
||||
gtk_widget_child_notify (child, "secondary");
|
||||
|
||||
@@ -399,9 +433,10 @@ _gtk_button_box_child_requisition (GtkWidget *widget,
|
||||
int *width,
|
||||
int *height)
|
||||
{
|
||||
GtkButtonBoxPriv *priv;
|
||||
GtkButtonBox *bbox;
|
||||
GtkBoxChild *child;
|
||||
GList *children;
|
||||
GList *children, *list;
|
||||
gint nchildren;
|
||||
gint nsecondaries;
|
||||
gint needed_width;
|
||||
@@ -422,6 +457,7 @@ _gtk_button_box_child_requisition (GtkWidget *widget,
|
||||
g_return_if_fail (GTK_IS_BUTTON_BOX (widget));
|
||||
|
||||
bbox = GTK_BUTTON_BOX (widget);
|
||||
priv = bbox->priv;
|
||||
|
||||
gtk_widget_style_get (widget,
|
||||
"child-min-width", &width_default,
|
||||
@@ -429,19 +465,19 @@ _gtk_button_box_child_requisition (GtkWidget *widget,
|
||||
"child-internal-pad-x", &ipad_x_default,
|
||||
"child-internal-pad-y", &ipad_y_default,
|
||||
NULL);
|
||||
|
||||
child_min_width = bbox->child_min_width != GTK_BUTTONBOX_DEFAULT
|
||||
? bbox->child_min_width : width_default;
|
||||
child_min_height = bbox->child_min_height !=GTK_BUTTONBOX_DEFAULT
|
||||
? bbox->child_min_height : height_default;
|
||||
ipad_x = bbox->child_ipad_x != GTK_BUTTONBOX_DEFAULT
|
||||
? bbox->child_ipad_x : ipad_x_default;
|
||||
ipad_y = bbox->child_ipad_y != GTK_BUTTONBOX_DEFAULT
|
||||
? bbox->child_ipad_y : ipad_y_default;
|
||||
|
||||
child_min_width = priv->child_min_width != GTK_BUTTONBOX_DEFAULT
|
||||
? priv->child_min_width : width_default;
|
||||
child_min_height = priv->child_min_height != GTK_BUTTONBOX_DEFAULT
|
||||
? priv->child_min_height : height_default;
|
||||
ipad_x = priv->child_ipad_x != GTK_BUTTONBOX_DEFAULT
|
||||
? priv->child_ipad_x : ipad_x_default;
|
||||
ipad_y = priv->child_ipad_y != GTK_BUTTONBOX_DEFAULT
|
||||
? priv->child_ipad_y : ipad_y_default;
|
||||
|
||||
nchildren = 0;
|
||||
nsecondaries = 0;
|
||||
children = GTK_BOX(bbox)->children;
|
||||
list = children = gtk_container_get_children (GTK_CONTAINER (bbox));
|
||||
needed_width = child_min_width;
|
||||
needed_height = child_min_height;
|
||||
ipad_w = ipad_x * 2;
|
||||
@@ -466,6 +502,8 @@ _gtk_button_box_child_requisition (GtkWidget *widget,
|
||||
}
|
||||
}
|
||||
|
||||
g_list_free (list);
|
||||
|
||||
if (nvis_children)
|
||||
*nvis_children = nchildren;
|
||||
if (nvis_secondaries)
|
||||
@@ -497,22 +535,25 @@ static void
|
||||
gtk_button_box_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition)
|
||||
{
|
||||
GtkButtonBoxPriv *priv;
|
||||
GtkBox *box;
|
||||
GtkButtonBox *bbox;
|
||||
gint nvis_children;
|
||||
gint child_width;
|
||||
gint child_height;
|
||||
gint spacing;
|
||||
guint border_width;
|
||||
GtkButtonBoxStyle layout;
|
||||
GtkOrientation orientation;
|
||||
|
||||
box = GTK_BOX (widget);
|
||||
bbox = GTK_BUTTON_BOX (widget);
|
||||
priv = bbox->priv;
|
||||
|
||||
orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (widget));
|
||||
spacing = box->spacing;
|
||||
layout = bbox->layout_style != GTK_BUTTONBOX_DEFAULT_STYLE
|
||||
? bbox->layout_style : gtk_button_box_kludge_get_layout_default (GTK_BUTTON_BOX (widget));
|
||||
spacing = gtk_box_get_spacing (box);
|
||||
layout = priv->layout_style != GTK_BUTTONBOX_DEFAULT_STYLE
|
||||
? priv->layout_style : gtk_button_box_kludge_get_layout_default (GTK_BUTTON_BOX (widget));
|
||||
|
||||
_gtk_button_box_child_requisition (widget,
|
||||
&nvis_children,
|
||||
@@ -561,18 +602,20 @@ gtk_button_box_size_request (GtkWidget *widget,
|
||||
requisition->width = child_width;
|
||||
}
|
||||
|
||||
requisition->width += GTK_CONTAINER (box)->border_width * 2;
|
||||
requisition->height += GTK_CONTAINER (box)->border_width * 2;
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (box));
|
||||
requisition->width += border_width * 2;
|
||||
requisition->height += border_width * 2;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_button_box_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation)
|
||||
{
|
||||
GtkButtonBoxPriv *priv;
|
||||
GtkBox *base_box;
|
||||
GtkButtonBox *box;
|
||||
GtkBoxChild *child;
|
||||
GList *children;
|
||||
GList *children, *list;
|
||||
GtkAllocation child_allocation;
|
||||
gint nvis_children;
|
||||
gint n_secondaries;
|
||||
@@ -588,14 +631,18 @@ gtk_button_box_size_allocate (GtkWidget *widget,
|
||||
gint childspacing = 0;
|
||||
GtkButtonBoxStyle layout;
|
||||
gint spacing;
|
||||
guint border_width;
|
||||
GtkOrientation orientation;
|
||||
|
||||
orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (widget));
|
||||
base_box = GTK_BOX (widget);
|
||||
box = GTK_BUTTON_BOX (widget);
|
||||
spacing = base_box->spacing;
|
||||
layout = box->layout_style != GTK_BUTTONBOX_DEFAULT_STYLE
|
||||
? box->layout_style : gtk_button_box_kludge_get_layout_default (GTK_BUTTON_BOX (widget));
|
||||
priv = box->priv;
|
||||
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (box));
|
||||
orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (widget));
|
||||
spacing = gtk_box_get_spacing (base_box);
|
||||
layout = priv->layout_style != GTK_BUTTONBOX_DEFAULT_STYLE
|
||||
? priv->layout_style : gtk_button_box_kludge_get_layout_default (GTK_BUTTON_BOX (widget));
|
||||
_gtk_button_box_child_requisition (widget,
|
||||
&nvis_children,
|
||||
&n_secondaries,
|
||||
@@ -604,9 +651,9 @@ gtk_button_box_size_allocate (GtkWidget *widget,
|
||||
widget->allocation = *allocation;
|
||||
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
width = allocation->width - GTK_CONTAINER (box)->border_width*2;
|
||||
width = allocation->width - border_width*2;
|
||||
else
|
||||
height = allocation->height - GTK_CONTAINER (box)->border_width*2;
|
||||
height = allocation->height - border_width*2;
|
||||
|
||||
switch (layout)
|
||||
{
|
||||
@@ -616,8 +663,7 @@ gtk_button_box_size_allocate (GtkWidget *widget,
|
||||
{
|
||||
childspacing = (width - (nvis_children * child_width))
|
||||
/ (nvis_children + 1);
|
||||
x = allocation->x + GTK_CONTAINER (box)->border_width
|
||||
+ childspacing;
|
||||
x = allocation->x + border_width + childspacing;
|
||||
secondary_x = x + ((nvis_children - n_secondaries)
|
||||
* (child_width + childspacing));
|
||||
}
|
||||
@@ -625,8 +671,7 @@ gtk_button_box_size_allocate (GtkWidget *widget,
|
||||
{
|
||||
childspacing = (height - (nvis_children * child_height))
|
||||
/ (nvis_children + 1);
|
||||
y = allocation->y + GTK_CONTAINER (box)->border_width
|
||||
+ childspacing;
|
||||
y = allocation->y + border_width + childspacing;
|
||||
secondary_y = y + ((nvis_children - n_secondaries)
|
||||
* (child_height + childspacing));
|
||||
}
|
||||
@@ -641,7 +686,7 @@ gtk_button_box_size_allocate (GtkWidget *widget,
|
||||
{
|
||||
childspacing = (width - (nvis_children * child_width))
|
||||
/ (nvis_children - 1);
|
||||
x = allocation->x + GTK_CONTAINER (box)->border_width;
|
||||
x = allocation->x + border_width;
|
||||
secondary_x = x + ((nvis_children - n_secondaries)
|
||||
* (child_width + childspacing));
|
||||
}
|
||||
@@ -659,7 +704,7 @@ gtk_button_box_size_allocate (GtkWidget *widget,
|
||||
{
|
||||
childspacing = (height - (nvis_children*child_height))
|
||||
/ (nvis_children-1);
|
||||
y = allocation->y + GTK_CONTAINER (box)->border_width;
|
||||
y = allocation->y + border_width;
|
||||
secondary_y = y + ((nvis_children - n_secondaries)
|
||||
* (child_height + childspacing));
|
||||
}
|
||||
@@ -679,20 +724,20 @@ gtk_button_box_size_allocate (GtkWidget *widget,
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
childspacing = spacing;
|
||||
x = allocation->x + GTK_CONTAINER (box)->border_width;
|
||||
x = allocation->x + border_width;
|
||||
secondary_x = allocation->x + allocation->width
|
||||
- child_width * n_secondaries
|
||||
- spacing * (n_secondaries - 1)
|
||||
- GTK_CONTAINER (box)->border_width;
|
||||
- border_width;
|
||||
}
|
||||
else
|
||||
{
|
||||
childspacing = spacing;
|
||||
y = allocation->y + GTK_CONTAINER (box)->border_width;
|
||||
y = allocation->y + border_width;
|
||||
secondary_y = allocation->y + allocation->height
|
||||
- child_height * n_secondaries
|
||||
- spacing * (n_secondaries - 1)
|
||||
- GTK_CONTAINER (box)->border_width;
|
||||
- border_width;
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -705,8 +750,8 @@ gtk_button_box_size_allocate (GtkWidget *widget,
|
||||
x = allocation->x + allocation->width
|
||||
- child_width * (nvis_children - n_secondaries)
|
||||
- spacing * (nvis_children - n_secondaries - 1)
|
||||
- GTK_CONTAINER (box)->border_width;
|
||||
secondary_x = allocation->x + GTK_CONTAINER (box)->border_width;
|
||||
- border_width;
|
||||
secondary_x = allocation->x + border_width;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -714,8 +759,8 @@ gtk_button_box_size_allocate (GtkWidget *widget,
|
||||
y = allocation->y + allocation->height
|
||||
- child_height * (nvis_children - n_secondaries)
|
||||
- spacing * (nvis_children - n_secondaries - 1)
|
||||
- GTK_CONTAINER (box)->border_width;
|
||||
secondary_y = allocation->y + GTK_CONTAINER (box)->border_width;
|
||||
- border_width;
|
||||
secondary_y = allocation->y + border_width;
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -730,7 +775,7 @@ gtk_button_box_size_allocate (GtkWidget *widget,
|
||||
- (child_width * (nvis_children - n_secondaries)
|
||||
+ spacing * (nvis_children - n_secondaries - 1))) / 2
|
||||
+ (n_secondaries * child_width + n_secondaries * spacing) / 2;
|
||||
secondary_x = allocation->x + GTK_CONTAINER (box)->border_width;
|
||||
secondary_x = allocation->x + border_width;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -740,7 +785,7 @@ gtk_button_box_size_allocate (GtkWidget *widget,
|
||||
- (child_height * (nvis_children - n_secondaries)
|
||||
+ spacing * (nvis_children - n_secondaries - 1))) / 2
|
||||
+ (n_secondaries * child_height + n_secondaries * spacing) / 2;
|
||||
secondary_y = allocation->y + GTK_CONTAINER (box)->border_width;
|
||||
secondary_y = allocation->y + border_width;
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -761,7 +806,7 @@ gtk_button_box_size_allocate (GtkWidget *widget,
|
||||
childspace = child_height + childspacing;
|
||||
}
|
||||
|
||||
children = GTK_BOX (box)->children;
|
||||
list = children = gtk_container_get_children (GTK_CONTAINER (box));
|
||||
|
||||
while (children)
|
||||
{
|
||||
@@ -811,6 +856,8 @@ gtk_button_box_size_allocate (GtkWidget *widget,
|
||||
gtk_widget_size_allocate (child->widget, &child_allocation);
|
||||
}
|
||||
}
|
||||
|
||||
g_list_free (list);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -47,16 +47,15 @@ G_BEGIN_DECLS
|
||||
#define GTK_BUTTONBOX_DEFAULT -1
|
||||
|
||||
typedef struct _GtkButtonBox GtkButtonBox;
|
||||
typedef struct _GtkButtonBoxPriv GtkButtonBoxPriv;
|
||||
typedef struct _GtkButtonBoxClass GtkButtonBoxClass;
|
||||
|
||||
struct _GtkButtonBox
|
||||
{
|
||||
GtkBox box;
|
||||
gint GSEAL (child_min_width);
|
||||
gint GSEAL (child_min_height);
|
||||
gint GSEAL (child_ipad_x);
|
||||
gint GSEAL (child_ipad_y);
|
||||
GtkButtonBoxStyle GSEAL (layout_style);
|
||||
|
||||
/*< private >*/
|
||||
GtkButtonBoxPriv *priv;
|
||||
};
|
||||
|
||||
struct _GtkButtonBoxClass
|
||||
|
||||
82
gtk/gtkbin.c
82
gtk/gtkbin.c
@@ -43,6 +43,11 @@
|
||||
#include "gtkintl.h"
|
||||
|
||||
|
||||
struct _GtkBinPriv
|
||||
{
|
||||
GtkWidget *child;
|
||||
};
|
||||
|
||||
static void gtk_bin_add (GtkContainer *container,
|
||||
GtkWidget *widget);
|
||||
static void gtk_bin_remove (GtkContainer *container,
|
||||
@@ -82,21 +87,32 @@ gtk_bin_class_init (GtkBinClass *class)
|
||||
container_class->remove = gtk_bin_remove;
|
||||
container_class->forall = gtk_bin_forall;
|
||||
container_class->child_type = gtk_bin_child_type;
|
||||
|
||||
g_type_class_add_private (class, sizeof (GtkBinPriv));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_bin_init (GtkBin *bin)
|
||||
{
|
||||
GtkBinPriv *priv;
|
||||
|
||||
bin->priv = G_TYPE_INSTANCE_GET_PRIVATE (bin,
|
||||
GTK_TYPE_BIN,
|
||||
GtkBinPriv);
|
||||
priv = bin->priv;
|
||||
|
||||
gtk_widget_set_has_window (GTK_WIDGET (bin), FALSE);
|
||||
|
||||
bin->child = NULL;
|
||||
priv->child = NULL;
|
||||
}
|
||||
|
||||
|
||||
static GType
|
||||
gtk_bin_child_type (GtkContainer *container)
|
||||
{
|
||||
if (!GTK_BIN (container)->child)
|
||||
GtkBinPriv *priv = GTK_BIN (container)->priv;
|
||||
|
||||
if (!priv->child)
|
||||
return GTK_TYPE_WIDGET;
|
||||
else
|
||||
return G_TYPE_NONE;
|
||||
@@ -107,8 +123,9 @@ gtk_bin_add (GtkContainer *container,
|
||||
GtkWidget *child)
|
||||
{
|
||||
GtkBin *bin = GTK_BIN (container);
|
||||
GtkBinPriv *priv = bin->priv;
|
||||
|
||||
if (bin->child != NULL)
|
||||
if (priv->child != NULL)
|
||||
{
|
||||
g_warning ("Attempting to add a widget with type %s to a %s, "
|
||||
"but as a GtkBin subclass a %s can only contain one widget at a time; "
|
||||
@@ -116,12 +133,12 @@ gtk_bin_add (GtkContainer *container,
|
||||
g_type_name (G_OBJECT_TYPE (child)),
|
||||
g_type_name (G_OBJECT_TYPE (bin)),
|
||||
g_type_name (G_OBJECT_TYPE (bin)),
|
||||
g_type_name (G_OBJECT_TYPE (bin->child)));
|
||||
g_type_name (G_OBJECT_TYPE (priv->child)));
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_widget_set_parent (child, GTK_WIDGET (bin));
|
||||
bin->child = child;
|
||||
priv->child = child;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -129,14 +146,15 @@ gtk_bin_remove (GtkContainer *container,
|
||||
GtkWidget *child)
|
||||
{
|
||||
GtkBin *bin = GTK_BIN (container);
|
||||
GtkBinPriv *priv = bin->priv;
|
||||
gboolean widget_was_visible;
|
||||
|
||||
g_return_if_fail (bin->child == child);
|
||||
g_return_if_fail (priv->child == child);
|
||||
|
||||
widget_was_visible = gtk_widget_get_visible (child);
|
||||
|
||||
gtk_widget_unparent (child);
|
||||
bin->child = NULL;
|
||||
priv->child = NULL;
|
||||
|
||||
/* queue resize regardless of gtk_widget_get_visible (container),
|
||||
* since that's what is needed by toplevels, which derive from GtkBin.
|
||||
@@ -152,9 +170,10 @@ gtk_bin_forall (GtkContainer *container,
|
||||
gpointer callback_data)
|
||||
{
|
||||
GtkBin *bin = GTK_BIN (container);
|
||||
GtkBinPriv *priv = bin->priv;
|
||||
|
||||
if (bin->child)
|
||||
(* callback) (bin->child, callback_data);
|
||||
if (priv->child)
|
||||
(* callback) (priv->child, callback_data);
|
||||
}
|
||||
|
||||
|
||||
@@ -181,9 +200,10 @@ static GtkSizeRequestMode
|
||||
gtk_bin_get_request_mode (GtkSizeRequest *widget)
|
||||
{
|
||||
GtkBin *bin = GTK_BIN (widget);
|
||||
GtkBinPriv *priv = bin->priv;
|
||||
|
||||
if (bin->child)
|
||||
return gtk_size_request_get_request_mode (GTK_SIZE_REQUEST (bin->child));
|
||||
if (priv->child)
|
||||
return gtk_size_request_get_request_mode (GTK_SIZE_REQUEST (priv->child));
|
||||
|
||||
return GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH;
|
||||
}
|
||||
@@ -193,13 +213,14 @@ get_child_padding_delta (GtkBin *bin,
|
||||
gint *delta_h,
|
||||
gint *delta_v)
|
||||
{
|
||||
GtkBinPriv *priv = bin->priv;
|
||||
gint hmin, vmin, child_hmin, child_vmin;
|
||||
|
||||
gtk_size_request_get_width (GTK_SIZE_REQUEST (bin), &hmin, NULL);
|
||||
gtk_size_request_get_height (GTK_SIZE_REQUEST (bin), &vmin, NULL);
|
||||
|
||||
gtk_size_request_get_width (GTK_SIZE_REQUEST (bin->child), &child_hmin, NULL);
|
||||
gtk_size_request_get_height (GTK_SIZE_REQUEST (bin->child), &child_vmin, NULL);
|
||||
gtk_size_request_get_width (GTK_SIZE_REQUEST (priv->child), &child_hmin, NULL);
|
||||
gtk_size_request_get_height (GTK_SIZE_REQUEST (priv->child), &child_vmin, NULL);
|
||||
|
||||
*delta_h = hmin - child_hmin;
|
||||
*delta_v = vmin - child_vmin;
|
||||
@@ -212,16 +233,17 @@ gtk_bin_get_width_for_height (GtkSizeRequest *widget,
|
||||
gint *natural_width)
|
||||
{
|
||||
GtkBin *bin = GTK_BIN (widget);
|
||||
GtkBinPriv *priv = bin->priv;
|
||||
gint hdelta, vdelta, child_min, child_nat;
|
||||
|
||||
if (bin->child)
|
||||
if (priv->child)
|
||||
{
|
||||
get_child_padding_delta (bin, &hdelta, &vdelta);
|
||||
|
||||
gtk_size_request_get_width_for_height (GTK_SIZE_REQUEST (bin->child),
|
||||
height - vdelta,
|
||||
&child_min, &child_nat);
|
||||
|
||||
|
||||
gtk_size_request_get_width_for_height (GTK_SIZE_REQUEST (priv->child),
|
||||
height - vdelta,
|
||||
&child_min, &child_nat);
|
||||
|
||||
if (minimum_width)
|
||||
*minimum_width = child_min + hdelta;
|
||||
|
||||
@@ -239,16 +261,17 @@ gtk_bin_get_height_for_width (GtkSizeRequest *widget,
|
||||
gint *natural_height)
|
||||
{
|
||||
GtkBin *bin = GTK_BIN (widget);
|
||||
GtkBinPriv *priv = bin->priv;
|
||||
gint hdelta, vdelta, child_min, child_nat;
|
||||
|
||||
if (bin->child)
|
||||
if (priv->child)
|
||||
{
|
||||
get_child_padding_delta (bin, &hdelta, &vdelta);
|
||||
|
||||
gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (bin->child),
|
||||
width - hdelta,
|
||||
&child_min, &child_nat);
|
||||
|
||||
|
||||
gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (priv->child),
|
||||
width - hdelta,
|
||||
&child_min, &child_nat);
|
||||
|
||||
if (minimum_height)
|
||||
*minimum_height = child_min + vdelta;
|
||||
|
||||
@@ -275,5 +298,12 @@ gtk_bin_get_child (GtkBin *bin)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_BIN (bin), NULL);
|
||||
|
||||
return bin->child;
|
||||
return bin->priv->child;
|
||||
}
|
||||
|
||||
void
|
||||
_gtk_bin_set_child (GtkBin *bin,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
bin->priv->child = widget;
|
||||
}
|
||||
|
||||
@@ -46,13 +46,15 @@ G_BEGIN_DECLS
|
||||
|
||||
|
||||
typedef struct _GtkBin GtkBin;
|
||||
typedef struct _GtkBinPriv GtkBinPriv;
|
||||
typedef struct _GtkBinClass GtkBinClass;
|
||||
|
||||
struct _GtkBin
|
||||
{
|
||||
GtkContainer container;
|
||||
|
||||
GtkWidget *GSEAL (child);
|
||||
/*< private >*/
|
||||
GtkBinPriv *priv;
|
||||
};
|
||||
|
||||
struct _GtkBinClass
|
||||
@@ -65,6 +67,9 @@ GType gtk_bin_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget *gtk_bin_get_child (GtkBin *bin);
|
||||
|
||||
void _gtk_bin_set_child (GtkBin *bin,
|
||||
GtkWidget *widget);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_BIN_H__ */
|
||||
|
||||
207
gtk/gtkbox.c
207
gtk/gtkbox.c
@@ -99,16 +99,19 @@ enum {
|
||||
};
|
||||
|
||||
|
||||
typedef struct _GtkBoxPrivate GtkBoxPrivate;
|
||||
|
||||
struct _GtkBoxPrivate
|
||||
struct _GtkBoxPriv
|
||||
{
|
||||
GtkOrientation orientation;
|
||||
guint default_expand : 1;
|
||||
guint spacing_set : 1;
|
||||
GtkOrientation orientation;
|
||||
|
||||
GList *children;
|
||||
|
||||
gint16 spacing;
|
||||
|
||||
guint default_expand : 1;
|
||||
guint homogeneous : 1;
|
||||
guint spacing_set : 1;
|
||||
};
|
||||
|
||||
#define GTK_BOX_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_BOX, GtkBoxPrivate))
|
||||
|
||||
typedef struct _GtkBoxDesiredSizes GtkBoxDesiredSizes;
|
||||
typedef struct _GtkBoxSpreading GtkBoxSpreading;
|
||||
@@ -280,23 +283,28 @@ gtk_box_class_init (GtkBoxClass *class)
|
||||
-1, G_MAXINT, 0,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (GtkBoxPrivate));
|
||||
g_type_class_add_private (object_class, sizeof (GtkBoxPriv));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_box_init (GtkBox *box)
|
||||
{
|
||||
GtkBoxPrivate *private = GTK_BOX_GET_PRIVATE (box);
|
||||
GtkBoxPriv *private;
|
||||
|
||||
box->priv = G_TYPE_INSTANCE_GET_PRIVATE (box,
|
||||
GTK_TYPE_BOX,
|
||||
GtkBoxPriv);
|
||||
private = box->priv;
|
||||
|
||||
gtk_widget_set_has_window (GTK_WIDGET (box), FALSE);
|
||||
gtk_widget_set_redraw_on_allocate (GTK_WIDGET (box), FALSE);
|
||||
|
||||
box->children = NULL;
|
||||
box->spacing = 0;
|
||||
box->homogeneous = FALSE;
|
||||
|
||||
private->orientation = GTK_ORIENTATION_HORIZONTAL;
|
||||
private->children = NULL;
|
||||
|
||||
private->default_expand = FALSE;
|
||||
private->homogeneous = FALSE;
|
||||
private->spacing = 0;
|
||||
private->spacing_set = FALSE;
|
||||
}
|
||||
|
||||
@@ -307,7 +315,7 @@ gtk_box_set_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkBox *box = GTK_BOX (object);
|
||||
GtkBoxPrivate *private = GTK_BOX_GET_PRIVATE (box);
|
||||
GtkBoxPriv *private = box->priv;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
@@ -334,7 +342,7 @@ gtk_box_get_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkBox *box = GTK_BOX (object);
|
||||
GtkBoxPrivate *private = GTK_BOX_GET_PRIVATE (box);
|
||||
GtkBoxPriv *private = box->priv;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
@@ -342,10 +350,10 @@ gtk_box_get_property (GObject *object,
|
||||
g_value_set_enum (value, private->orientation);
|
||||
break;
|
||||
case PROP_SPACING:
|
||||
g_value_set_int (value, box->spacing);
|
||||
g_value_set_int (value, private->spacing);
|
||||
break;
|
||||
case PROP_HOMOGENEOUS:
|
||||
g_value_set_boolean (value, box->homogeneous);
|
||||
g_value_set_boolean (value, private->homogeneous);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
@@ -355,14 +363,17 @@ gtk_box_get_property (GObject *object,
|
||||
|
||||
|
||||
static void
|
||||
count_expand_children (GtkBox *box, gint *visible_children, gint *expand_children)
|
||||
count_expand_children (GtkBox *box,
|
||||
gint *visible_children,
|
||||
gint *expand_children)
|
||||
{
|
||||
GtkBoxPriv *private = box->priv;
|
||||
GList *children;
|
||||
GtkBoxChild *child;
|
||||
|
||||
*visible_children = *expand_children = 0;
|
||||
|
||||
for (children = box->children; children; children = children->next)
|
||||
for (children = private->children; children; children = children->next)
|
||||
{
|
||||
child = children->data;
|
||||
|
||||
@@ -404,7 +415,7 @@ gtk_box_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation)
|
||||
{
|
||||
GtkBox *box = GTK_BOX (widget);
|
||||
GtkBoxPrivate *private = GTK_BOX_GET_PRIVATE (box);
|
||||
GtkBoxPriv *private = box->priv;
|
||||
GtkBoxChild *child;
|
||||
GList *children;
|
||||
gint nvis_children;
|
||||
@@ -416,7 +427,7 @@ gtk_box_size_allocate (GtkWidget *widget,
|
||||
|
||||
if (nvis_children > 0)
|
||||
{
|
||||
gint border_width = GTK_CONTAINER (box)->border_width;
|
||||
guint border_width = gtk_container_get_border_width (GTK_CONTAINER (box));
|
||||
GtkTextDirection direction = gtk_widget_get_direction (widget);
|
||||
GtkAllocation child_allocation;
|
||||
GtkBoxSpreading *spreading = g_newa (GtkBoxSpreading, nvis_children);
|
||||
@@ -430,13 +441,13 @@ gtk_box_size_allocate (GtkWidget *widget,
|
||||
gint child_size;
|
||||
|
||||
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
size = allocation->width - border_width * 2 - (nvis_children - 1) * box->spacing;
|
||||
size = allocation->width - border_width * 2 - (nvis_children - 1) * private->spacing;
|
||||
else
|
||||
size = allocation->height - border_width * 2 - (nvis_children - 1) * box->spacing;
|
||||
size = allocation->height - border_width * 2 - (nvis_children - 1) * private->spacing;
|
||||
|
||||
/* Retrieve desired size for visible children */
|
||||
i = 0;
|
||||
children = box->children;
|
||||
children = private->children;
|
||||
while (children)
|
||||
{
|
||||
child = children->data;
|
||||
@@ -484,15 +495,15 @@ gtk_box_size_allocate (GtkWidget *widget,
|
||||
}
|
||||
}
|
||||
|
||||
if (box->homogeneous)
|
||||
if (private->homogeneous)
|
||||
{
|
||||
/* If were homogenous we still need to run the above loop to get the minimum sizes
|
||||
* for children that are not going to fill
|
||||
*/
|
||||
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
size = allocation->width - border_width * 2 - (nvis_children - 1) * box->spacing;
|
||||
size = allocation->width - border_width * 2 - (nvis_children - 1) * private->spacing;
|
||||
else
|
||||
size = allocation->height - border_width * 2 - (nvis_children - 1) * box->spacing;
|
||||
size = allocation->height - border_width * 2 - (nvis_children - 1) * private->spacing;
|
||||
|
||||
extra = size / nvis_children;
|
||||
}
|
||||
@@ -573,7 +584,7 @@ gtk_box_size_allocate (GtkWidget *widget,
|
||||
}
|
||||
|
||||
i = 0;
|
||||
children = box->children;
|
||||
children = private->children;
|
||||
while (children)
|
||||
{
|
||||
child = children->data;
|
||||
@@ -584,7 +595,7 @@ gtk_box_size_allocate (GtkWidget *widget,
|
||||
if (child->pack == packing)
|
||||
{
|
||||
/* Assign the child's size. */
|
||||
if (box->homogeneous)
|
||||
if (private->homogeneous)
|
||||
{
|
||||
if (nvis_children == 1)
|
||||
child_size = size;
|
||||
@@ -626,11 +637,11 @@ gtk_box_size_allocate (GtkWidget *widget,
|
||||
|
||||
if (packing == GTK_PACK_START)
|
||||
{
|
||||
x += child_size + box->spacing;
|
||||
x += child_size + private->spacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
x -= child_size + box->spacing;
|
||||
x -= child_size + private->spacing;
|
||||
|
||||
child_allocation.x -= child_size;
|
||||
}
|
||||
@@ -654,11 +665,11 @@ gtk_box_size_allocate (GtkWidget *widget,
|
||||
|
||||
if (packing == GTK_PACK_START)
|
||||
{
|
||||
y += child_size + box->spacing;
|
||||
y += child_size + private->spacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
y -= child_size + box->spacing;
|
||||
y -= child_size + private->spacing;
|
||||
|
||||
child_allocation.y -= child_size;
|
||||
}
|
||||
@@ -780,7 +791,7 @@ gtk_box_get_child_property (GtkContainer *container,
|
||||
break;
|
||||
case CHILD_PROP_POSITION:
|
||||
i = 0;
|
||||
for (list = GTK_BOX (container)->children; list; list = list->next)
|
||||
for (list = GTK_BOX (container)->priv->children; list; list = list->next)
|
||||
{
|
||||
GtkBoxChild *child_entry;
|
||||
|
||||
@@ -805,6 +816,7 @@ gtk_box_pack (GtkBox *box,
|
||||
guint padding,
|
||||
GtkPackType pack_type)
|
||||
{
|
||||
GtkBoxPriv *private = box->priv;
|
||||
GtkBoxChild *child_info;
|
||||
|
||||
g_return_if_fail (GTK_IS_BOX (box));
|
||||
@@ -819,7 +831,7 @@ gtk_box_pack (GtkBox *box,
|
||||
child_info->pack = pack_type;
|
||||
child_info->is_secondary = FALSE;
|
||||
|
||||
box->children = g_list_append (box->children, child_info);
|
||||
private->children = g_list_append (private->children, child_info);
|
||||
|
||||
gtk_widget_freeze_child_notify (child);
|
||||
|
||||
@@ -849,7 +861,7 @@ gtk_box_size_request_init (GtkSizeRequestIface *iface)
|
||||
static GtkSizeRequestMode
|
||||
gtk_box_get_request_mode (GtkSizeRequest *widget)
|
||||
{
|
||||
GtkBoxPrivate *private = GTK_BOX_GET_PRIVATE (widget);
|
||||
GtkBoxPriv *private = GTK_BOX (widget)->priv;
|
||||
|
||||
return (private->orientation == GTK_ORIENTATION_VERTICAL) ?
|
||||
GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH : GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT;
|
||||
@@ -862,21 +874,21 @@ gtk_box_get_size (GtkSizeRequest *widget,
|
||||
gint *natural_size)
|
||||
{
|
||||
GtkBox *box;
|
||||
GtkBoxPrivate *private;
|
||||
GtkBoxPriv *private;
|
||||
GList *children;
|
||||
gint nvis_children;
|
||||
gint border_width;
|
||||
gint minimum, natural;
|
||||
|
||||
box = GTK_BOX (widget);
|
||||
private = GTK_BOX_GET_PRIVATE (box);
|
||||
border_width = GTK_CONTAINER (box)->border_width;
|
||||
private = box->priv;
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (box));
|
||||
|
||||
minimum = natural = 0;
|
||||
|
||||
nvis_children = 0;
|
||||
|
||||
for (children = box->children; children; children = children->next)
|
||||
for (children = private->children; children; children = children->next)
|
||||
{
|
||||
GtkBoxChild *child = children->data;
|
||||
|
||||
@@ -893,7 +905,7 @@ gtk_box_get_size (GtkSizeRequest *widget,
|
||||
|
||||
if (private->orientation == orientation)
|
||||
{
|
||||
if (box->homogeneous)
|
||||
if (private->homogeneous)
|
||||
{
|
||||
gint largest;
|
||||
|
||||
@@ -922,13 +934,13 @@ gtk_box_get_size (GtkSizeRequest *widget,
|
||||
|
||||
if (nvis_children > 0 && private->orientation == orientation)
|
||||
{
|
||||
if (box->homogeneous)
|
||||
if (private->homogeneous)
|
||||
{
|
||||
minimum *= nvis_children;
|
||||
natural *= nvis_children;
|
||||
}
|
||||
minimum += (nvis_children - 1) * box->spacing;
|
||||
natural += (nvis_children - 1) * box->spacing;
|
||||
minimum += (nvis_children - 1) * private->spacing;
|
||||
natural += (nvis_children - 1) * private->spacing;
|
||||
}
|
||||
|
||||
minimum += border_width * 2;
|
||||
@@ -963,13 +975,13 @@ gtk_box_compute_size_for_opposing_orientation (GtkBox *box,
|
||||
gint *minimum_size,
|
||||
gint *natural_size)
|
||||
{
|
||||
GtkBoxPrivate *private = GTK_BOX_GET_PRIVATE (box);
|
||||
GtkBoxPriv *private = box->priv;
|
||||
GtkBoxChild *child;
|
||||
GList *children;
|
||||
gint nvis_children;
|
||||
gint nexpand_children;
|
||||
gint computed_minimum = 0, computed_natural = 0;
|
||||
gint border_width = GTK_CONTAINER (box)->border_width;
|
||||
guint border_width = gtk_container_get_border_width (GTK_CONTAINER (box));
|
||||
|
||||
count_expand_children (box, &nvis_children, &nexpand_children);
|
||||
|
||||
@@ -982,10 +994,10 @@ gtk_box_compute_size_for_opposing_orientation (GtkBox *box,
|
||||
gint extra, i;
|
||||
gint child_size, child_minimum, child_natural;
|
||||
|
||||
size = avail_size - border_width * 2 - (nvis_children - 1) * box->spacing;
|
||||
size = avail_size - border_width * 2 - (nvis_children - 1) * private->spacing;
|
||||
|
||||
/* Retrieve desired size for visible children */
|
||||
for (i = 0, children = box->children; children; children = children->next)
|
||||
for (i = 0, children = private->children; children; children = children->next)
|
||||
{
|
||||
child = children->data;
|
||||
|
||||
@@ -1024,12 +1036,12 @@ gtk_box_compute_size_for_opposing_orientation (GtkBox *box,
|
||||
}
|
||||
}
|
||||
|
||||
if (box->homogeneous)
|
||||
if (private->homogeneous)
|
||||
{
|
||||
/* If were homogenous we still need to run the above loop to get the minimum sizes
|
||||
* for children that are not going to fill
|
||||
*/
|
||||
size = avail_size - border_width * 2 - (nvis_children - 1) * box->spacing;
|
||||
size = avail_size - border_width * 2 - (nvis_children - 1) * private->spacing;
|
||||
extra = size / nvis_children;
|
||||
}
|
||||
else
|
||||
@@ -1089,7 +1101,7 @@ gtk_box_compute_size_for_opposing_orientation (GtkBox *box,
|
||||
/* Allocate child positions. */
|
||||
for (packing = GTK_PACK_START; packing <= GTK_PACK_END; ++packing)
|
||||
{
|
||||
for (i = 0, children = box->children; children; children = children->next)
|
||||
for (i = 0, children = private->children; children; children = children->next)
|
||||
{
|
||||
child = children->data;
|
||||
|
||||
@@ -1098,7 +1110,7 @@ gtk_box_compute_size_for_opposing_orientation (GtkBox *box,
|
||||
if (child->pack == packing)
|
||||
{
|
||||
/* Assign the child's size. */
|
||||
if (box->homogeneous)
|
||||
if (private->homogeneous)
|
||||
{
|
||||
if (nvis_children == 1)
|
||||
child_size = size;
|
||||
@@ -1167,15 +1179,17 @@ gtk_box_compute_size_for_orientation (GtkBox *box,
|
||||
gint *minimum_size,
|
||||
gint *natural_size)
|
||||
{
|
||||
GtkBoxPrivate *private = GTK_BOX_GET_PRIVATE (box);
|
||||
GtkBoxPriv *private = box->priv;
|
||||
GList *children;
|
||||
gint nvis_children = 0;
|
||||
gint required_size = 0, required_natural = 0, child_size, child_natural;
|
||||
gint largest_child = 0, largest_natural = 0;
|
||||
guint border_width;
|
||||
|
||||
avail_size -= GTK_CONTAINER (box)->border_width * 2;
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (box));
|
||||
avail_size -= border_width * 2;
|
||||
|
||||
for (children = box->children; children != NULL;
|
||||
for (children = private->children; children != NULL;
|
||||
children = children->next, nvis_children++)
|
||||
{
|
||||
GtkBoxChild *child = children->data;
|
||||
@@ -1207,18 +1221,18 @@ gtk_box_compute_size_for_orientation (GtkBox *box,
|
||||
|
||||
if (nvis_children > 0)
|
||||
{
|
||||
if (box->homogeneous)
|
||||
if (private->homogeneous)
|
||||
{
|
||||
required_size = largest_child * nvis_children;
|
||||
required_natural = largest_natural * nvis_children;
|
||||
}
|
||||
|
||||
required_size += (nvis_children - 1) * box->spacing;
|
||||
required_natural += (nvis_children - 1) * box->spacing;
|
||||
required_size += (nvis_children - 1) * private->spacing;
|
||||
required_natural += (nvis_children - 1) * private->spacing;
|
||||
}
|
||||
|
||||
required_size += GTK_CONTAINER (box)->border_width * 2;
|
||||
required_natural += GTK_CONTAINER (box)->border_width * 2;
|
||||
required_size += border_width * 2;
|
||||
required_natural += border_width * 2;
|
||||
|
||||
if (minimum_size)
|
||||
*minimum_size = required_size;
|
||||
@@ -1234,7 +1248,7 @@ gtk_box_get_width_for_height (GtkSizeRequest *widget,
|
||||
gint *natural_width)
|
||||
{
|
||||
GtkBox *box = GTK_BOX (widget);
|
||||
GtkBoxPrivate *private = GTK_BOX_GET_PRIVATE (widget);
|
||||
GtkBoxPriv *private = box->priv;
|
||||
|
||||
if (private->orientation == GTK_ORIENTATION_VERTICAL)
|
||||
gtk_box_compute_size_for_opposing_orientation (box, height, minimum_width, natural_width);
|
||||
@@ -1249,7 +1263,7 @@ gtk_box_get_height_for_width (GtkSizeRequest *widget,
|
||||
gint *natural_height)
|
||||
{
|
||||
GtkBox *box = GTK_BOX (widget);
|
||||
GtkBoxPrivate *private = GTK_BOX_GET_PRIVATE (widget);
|
||||
GtkBoxPriv *private = box->priv;
|
||||
|
||||
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
gtk_box_compute_size_for_opposing_orientation (box, width, minimum_height, natural_height);
|
||||
@@ -1359,11 +1373,15 @@ void
|
||||
gtk_box_set_homogeneous (GtkBox *box,
|
||||
gboolean homogeneous)
|
||||
{
|
||||
GtkBoxPriv *private;
|
||||
|
||||
g_return_if_fail (GTK_IS_BOX (box));
|
||||
|
||||
if ((homogeneous ? TRUE : FALSE) != box->homogeneous)
|
||||
private = box->priv;
|
||||
|
||||
if ((homogeneous ? TRUE : FALSE) != private->homogeneous)
|
||||
{
|
||||
box->homogeneous = homogeneous ? TRUE : FALSE;
|
||||
private->homogeneous = homogeneous ? TRUE : FALSE;
|
||||
g_object_notify (G_OBJECT (box), "homogeneous");
|
||||
gtk_widget_queue_resize (GTK_WIDGET (box));
|
||||
}
|
||||
@@ -1383,7 +1401,7 @@ gtk_box_get_homogeneous (GtkBox *box)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_BOX (box), FALSE);
|
||||
|
||||
return box->homogeneous;
|
||||
return box->priv->homogeneous;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1398,11 +1416,15 @@ void
|
||||
gtk_box_set_spacing (GtkBox *box,
|
||||
gint spacing)
|
||||
{
|
||||
GtkBoxPriv *private;
|
||||
|
||||
g_return_if_fail (GTK_IS_BOX (box));
|
||||
|
||||
if (spacing != box->spacing)
|
||||
private = box->priv;
|
||||
|
||||
if (spacing != private->spacing)
|
||||
{
|
||||
box->spacing = spacing;
|
||||
private->spacing = spacing;
|
||||
_gtk_box_set_spacing_set (box, TRUE);
|
||||
|
||||
g_object_notify (G_OBJECT (box), "spacing");
|
||||
@@ -1424,18 +1446,18 @@ gtk_box_get_spacing (GtkBox *box)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_BOX (box), 0);
|
||||
|
||||
return box->spacing;
|
||||
return box->priv->spacing;
|
||||
}
|
||||
|
||||
void
|
||||
_gtk_box_set_spacing_set (GtkBox *box,
|
||||
gboolean spacing_set)
|
||||
{
|
||||
GtkBoxPrivate *private;
|
||||
GtkBoxPriv *private;
|
||||
|
||||
g_return_if_fail (GTK_IS_BOX (box));
|
||||
|
||||
private = GTK_BOX_GET_PRIVATE (box);
|
||||
private = box->priv;
|
||||
|
||||
private->spacing_set = spacing_set ? TRUE : FALSE;
|
||||
}
|
||||
@@ -1443,11 +1465,11 @@ _gtk_box_set_spacing_set (GtkBox *box,
|
||||
gboolean
|
||||
_gtk_box_get_spacing_set (GtkBox *box)
|
||||
{
|
||||
GtkBoxPrivate *private;
|
||||
GtkBoxPriv *private;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_BOX (box), FALSE);
|
||||
|
||||
private = GTK_BOX_GET_PRIVATE (box);
|
||||
private = box->priv;
|
||||
|
||||
return private->spacing_set;
|
||||
}
|
||||
@@ -1476,6 +1498,7 @@ gtk_box_reorder_child (GtkBox *box,
|
||||
GtkWidget *child,
|
||||
gint position)
|
||||
{
|
||||
GtkBoxPriv *priv;
|
||||
GList *old_link;
|
||||
GList *new_link;
|
||||
GtkBoxChild *child_info = NULL;
|
||||
@@ -1484,7 +1507,9 @@ gtk_box_reorder_child (GtkBox *box,
|
||||
g_return_if_fail (GTK_IS_BOX (box));
|
||||
g_return_if_fail (GTK_IS_WIDGET (child));
|
||||
|
||||
old_link = box->children;
|
||||
priv = box->priv;
|
||||
|
||||
old_link = priv->children;
|
||||
old_position = 0;
|
||||
while (old_link)
|
||||
{
|
||||
@@ -1501,14 +1526,14 @@ gtk_box_reorder_child (GtkBox *box,
|
||||
if (position == old_position)
|
||||
return;
|
||||
|
||||
box->children = g_list_delete_link (box->children, old_link);
|
||||
priv->children = g_list_delete_link (priv->children, old_link);
|
||||
|
||||
if (position < 0)
|
||||
new_link = NULL;
|
||||
else
|
||||
new_link = g_list_nth (box->children, position);
|
||||
new_link = g_list_nth (priv->children, position);
|
||||
|
||||
box->children = g_list_insert_before (box->children, new_link, child_info);
|
||||
priv->children = g_list_insert_before (priv->children, new_link, child_info);
|
||||
|
||||
gtk_widget_child_notify (child, "position");
|
||||
if (gtk_widget_get_visible (child)
|
||||
@@ -1535,13 +1560,16 @@ gtk_box_query_child_packing (GtkBox *box,
|
||||
guint *padding,
|
||||
GtkPackType *pack_type)
|
||||
{
|
||||
GtkBoxPriv *private;
|
||||
GList *list;
|
||||
GtkBoxChild *child_info = NULL;
|
||||
|
||||
g_return_if_fail (GTK_IS_BOX (box));
|
||||
g_return_if_fail (GTK_IS_WIDGET (child));
|
||||
|
||||
list = box->children;
|
||||
private = box->priv;
|
||||
|
||||
list = private->children;
|
||||
while (list)
|
||||
{
|
||||
child_info = list->data;
|
||||
@@ -1583,13 +1611,16 @@ gtk_box_set_child_packing (GtkBox *box,
|
||||
guint padding,
|
||||
GtkPackType pack_type)
|
||||
{
|
||||
GtkBoxPriv *private;
|
||||
GList *list;
|
||||
GtkBoxChild *child_info = NULL;
|
||||
|
||||
g_return_if_fail (GTK_IS_BOX (box));
|
||||
g_return_if_fail (GTK_IS_WIDGET (child));
|
||||
|
||||
list = box->children;
|
||||
private = box->priv;
|
||||
|
||||
list = private->children;
|
||||
while (list)
|
||||
{
|
||||
child_info = list->data;
|
||||
@@ -1624,11 +1655,11 @@ gtk_box_set_child_packing (GtkBox *box,
|
||||
void
|
||||
_gtk_box_set_old_defaults (GtkBox *box)
|
||||
{
|
||||
GtkBoxPrivate *private;
|
||||
GtkBoxPriv *private;
|
||||
|
||||
g_return_if_fail (GTK_IS_BOX (box));
|
||||
|
||||
private = GTK_BOX_GET_PRIVATE (box);
|
||||
private = box->priv;
|
||||
|
||||
private->default_expand = TRUE;
|
||||
}
|
||||
@@ -1637,11 +1668,11 @@ static void
|
||||
gtk_box_add (GtkContainer *container,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
GtkBoxPrivate *private = GTK_BOX_GET_PRIVATE (container);
|
||||
GtkBoxPriv *priv = GTK_BOX (container)->priv;
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (container), widget,
|
||||
private->default_expand,
|
||||
private->default_expand,
|
||||
priv->default_expand,
|
||||
priv->default_expand,
|
||||
0);
|
||||
}
|
||||
|
||||
@@ -1650,10 +1681,11 @@ gtk_box_remove (GtkContainer *container,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
GtkBox *box = GTK_BOX (container);
|
||||
GtkBoxPriv *priv = box->priv;
|
||||
GtkBoxChild *child;
|
||||
GList *children;
|
||||
|
||||
children = box->children;
|
||||
children = priv->children;
|
||||
while (children)
|
||||
{
|
||||
child = children->data;
|
||||
@@ -1665,7 +1697,7 @@ gtk_box_remove (GtkContainer *container,
|
||||
was_visible = gtk_widget_get_visible (widget);
|
||||
gtk_widget_unparent (widget);
|
||||
|
||||
box->children = g_list_remove_link (box->children, children);
|
||||
priv->children = g_list_remove_link (priv->children, children);
|
||||
g_list_free (children);
|
||||
g_free (child);
|
||||
|
||||
@@ -1689,10 +1721,11 @@ gtk_box_forall (GtkContainer *container,
|
||||
gpointer callback_data)
|
||||
{
|
||||
GtkBox *box = GTK_BOX (container);
|
||||
GtkBoxPriv *priv = box->priv;
|
||||
GtkBoxChild *child;
|
||||
GList *children;
|
||||
|
||||
children = box->children;
|
||||
children = priv->children;
|
||||
while (children)
|
||||
{
|
||||
child = children->data;
|
||||
@@ -1702,7 +1735,7 @@ gtk_box_forall (GtkContainer *container,
|
||||
(* callback) (child->widget, callback_data);
|
||||
}
|
||||
|
||||
children = g_list_last (box->children);
|
||||
children = g_list_last (priv->children);
|
||||
while (children)
|
||||
{
|
||||
child = children->data;
|
||||
|
||||
@@ -47,16 +47,15 @@ G_BEGIN_DECLS
|
||||
|
||||
|
||||
typedef struct _GtkBox GtkBox;
|
||||
typedef struct _GtkBoxPriv GtkBoxPriv;
|
||||
typedef struct _GtkBoxClass GtkBoxClass;
|
||||
|
||||
struct _GtkBox
|
||||
{
|
||||
GtkContainer container;
|
||||
|
||||
/*< public >*/
|
||||
GList *GSEAL (children);
|
||||
gint16 GSEAL (spacing);
|
||||
guint GSEAL (homogeneous) : 1;
|
||||
/*< private >*/
|
||||
GtkBoxPriv *priv;
|
||||
};
|
||||
|
||||
struct _GtkBoxClass
|
||||
|
||||
@@ -85,7 +85,7 @@ struct _GtkBuilder
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
GtkBuilderPrivate *GSEAL (priv);
|
||||
GtkBuilderPrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkBuilderClass
|
||||
|
||||
@@ -625,7 +625,7 @@ gtk_button_constructor (GType type,
|
||||
static GType
|
||||
gtk_button_child_type (GtkContainer *container)
|
||||
{
|
||||
if (!GTK_BIN (container)->child)
|
||||
if (!gtk_bin_get_child (GTK_BIN (container)))
|
||||
return GTK_TYPE_WIDGET;
|
||||
else
|
||||
return G_TYPE_NONE;
|
||||
@@ -647,10 +647,17 @@ maybe_set_alignment (GtkButton *button,
|
||||
else if (GTK_IS_ALIGNMENT (widget))
|
||||
{
|
||||
GtkAlignment *alignment = GTK_ALIGNMENT (widget);
|
||||
gfloat xscale, yscale;
|
||||
|
||||
g_object_get (alignment,
|
||||
"xscale", &xscale,
|
||||
"yscale", &yscale,
|
||||
NULL);
|
||||
|
||||
if (priv->align_set)
|
||||
gtk_alignment_set (alignment, priv->xalign, priv->yalign,
|
||||
alignment->xscale, alignment->yscale);
|
||||
gtk_alignment_set (alignment,
|
||||
priv->xalign, priv->yalign,
|
||||
xscale, yscale);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -798,6 +805,7 @@ static void
|
||||
activatable_update_short_label (GtkButton *button,
|
||||
GtkAction *action)
|
||||
{
|
||||
GtkWidget *child;
|
||||
GtkWidget *image;
|
||||
|
||||
if (gtk_button_get_use_stock (button))
|
||||
@@ -806,9 +814,10 @@ activatable_update_short_label (GtkButton *button,
|
||||
image = gtk_button_get_image (button);
|
||||
|
||||
/* Dont touch custom child... */
|
||||
child = gtk_bin_get_child (GTK_BIN (button));
|
||||
if (GTK_IS_IMAGE (image) ||
|
||||
GTK_BIN (button)->child == NULL ||
|
||||
GTK_IS_LABEL (GTK_BIN (button)->child))
|
||||
child == NULL ||
|
||||
GTK_IS_LABEL (child))
|
||||
{
|
||||
gtk_button_set_label (button, gtk_action_get_short_label (action));
|
||||
gtk_button_set_use_underline (button, TRUE);
|
||||
@@ -975,6 +984,7 @@ gtk_button_construct_child (GtkButton *button)
|
||||
{
|
||||
GtkButtonPrivate *priv = GTK_BUTTON_GET_PRIVATE (button);
|
||||
GtkStockItem item;
|
||||
GtkWidget *child;
|
||||
GtkWidget *label;
|
||||
GtkWidget *box;
|
||||
GtkWidget *align;
|
||||
@@ -1001,9 +1011,9 @@ gtk_button_construct_child (GtkButton *button)
|
||||
|
||||
priv->image = NULL;
|
||||
|
||||
if (GTK_BIN (button)->child)
|
||||
gtk_container_remove (GTK_CONTAINER (button),
|
||||
GTK_BIN (button)->child);
|
||||
child = gtk_bin_get_child (GTK_BIN (button));
|
||||
if (child)
|
||||
gtk_container_remove (GTK_CONTAINER (button), child);
|
||||
|
||||
if (button->use_stock &&
|
||||
button->label_text &&
|
||||
@@ -1273,7 +1283,7 @@ gtk_button_realize (GtkWidget *widget)
|
||||
button = GTK_BUTTON (widget);
|
||||
gtk_widget_set_realized (widget, TRUE);
|
||||
|
||||
border_width = GTK_CONTAINER (widget)->border_width;
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||
|
||||
attributes.window_type = GDK_WINDOW_CHILD;
|
||||
attributes.x = widget->allocation.x + border_width;
|
||||
@@ -1353,10 +1363,10 @@ gtk_button_update_image_spacing (GtkButton *button)
|
||||
if (!button->constructed || !priv->image)
|
||||
return;
|
||||
|
||||
child = GTK_BIN (button)->child;
|
||||
child = gtk_bin_get_child (GTK_BIN (button));
|
||||
if (GTK_IS_ALIGNMENT (child))
|
||||
{
|
||||
child = GTK_BIN (child)->child;
|
||||
child = gtk_bin_get_child (GTK_BIN (child));
|
||||
if (GTK_IS_BOX (child))
|
||||
{
|
||||
gtk_widget_style_get (GTK_WIDGET (button),
|
||||
@@ -1434,8 +1444,9 @@ gtk_button_size_allocate (GtkWidget *widget,
|
||||
{
|
||||
GtkButton *button = GTK_BUTTON (widget);
|
||||
GtkAllocation child_allocation;
|
||||
GtkWidget *child;
|
||||
|
||||
gint border_width = GTK_CONTAINER (widget)->border_width;
|
||||
guint border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||
gint xthickness = GTK_WIDGET (widget)->style->xthickness;
|
||||
gint ythickness = GTK_WIDGET (widget)->style->ythickness;
|
||||
GtkBorder default_border;
|
||||
@@ -1459,7 +1470,8 @@ gtk_button_size_allocate (GtkWidget *widget,
|
||||
widget->allocation.width - border_width * 2,
|
||||
widget->allocation.height - border_width * 2);
|
||||
|
||||
if (GTK_BIN (button)->child && gtk_widget_get_visible (GTK_BIN (button)->child))
|
||||
child = gtk_bin_get_child (GTK_BIN (button));
|
||||
if (child && gtk_widget_get_visible (child))
|
||||
{
|
||||
child_allocation.x = widget->allocation.x + border_width + inner_border.left + xthickness;
|
||||
child_allocation.y = widget->allocation.y + border_width + inner_border.top + ythickness;
|
||||
@@ -1504,7 +1516,7 @@ gtk_button_size_allocate (GtkWidget *widget,
|
||||
child_allocation.y += child_displacement_y;
|
||||
}
|
||||
|
||||
gtk_widget_size_allocate (GTK_BIN (button)->child, &child_allocation);
|
||||
gtk_widget_size_allocate (child, &child_allocation);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1530,7 +1542,7 @@ _gtk_button_paint (GtkButton *button,
|
||||
|
||||
if (gtk_widget_is_drawable (widget))
|
||||
{
|
||||
border_width = GTK_CONTAINER (widget)->border_width;
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||
|
||||
gtk_button_get_props (button, &default_border, &default_outside_border, NULL, &interior_focus);
|
||||
gtk_widget_style_get (widget,
|
||||
@@ -1883,6 +1895,7 @@ gtk_button_get_size (GtkSizeRequest *widget,
|
||||
gint focus_width;
|
||||
gint focus_pad;
|
||||
gint minimum, natural;
|
||||
guint border_width;
|
||||
|
||||
gtk_button_get_props (button, &default_border, NULL, &inner_border, NULL);
|
||||
gtk_widget_style_get (GTK_WIDGET (widget),
|
||||
@@ -1890,18 +1903,19 @@ gtk_button_get_size (GtkSizeRequest *widget,
|
||||
"focus-padding", &focus_pad,
|
||||
NULL);
|
||||
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
minimum = ((GTK_CONTAINER (widget)->border_width +
|
||||
minimum = ((border_width +
|
||||
GTK_WIDGET (widget)->style->xthickness) * 2 +
|
||||
inner_border.left + inner_border.right);
|
||||
|
||||
|
||||
if (gtk_widget_get_can_default (GTK_WIDGET (widget)))
|
||||
minimum += default_border.left + default_border.right;
|
||||
}
|
||||
else
|
||||
{
|
||||
minimum = ((GTK_CONTAINER (widget)->border_width +
|
||||
minimum = ((border_width +
|
||||
GTK_WIDGET (widget)->style->ythickness) * 2 +
|
||||
inner_border.top + inner_border.bottom);
|
||||
|
||||
@@ -2164,7 +2178,7 @@ gtk_button_set_alignment (GtkButton *button,
|
||||
priv->yalign = yalign;
|
||||
priv->align_set = 1;
|
||||
|
||||
maybe_set_alignment (button, GTK_BIN (button)->child);
|
||||
maybe_set_alignment (button, gtk_bin_get_child (GTK_BIN (button)));
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (button));
|
||||
g_object_notify (G_OBJECT (button), "xalign");
|
||||
|
||||
@@ -37,11 +37,25 @@ static void set_cell_bg_color (GtkCellRenderer *cell,
|
||||
GdkColor *color);
|
||||
|
||||
|
||||
#define GTK_CELL_RENDERER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_CELL_RENDERER, GtkCellRendererPrivate))
|
||||
|
||||
typedef struct _GtkCellRendererPrivate GtkCellRendererPrivate;
|
||||
struct _GtkCellRendererPrivate
|
||||
struct _GtkCellRendererPriv
|
||||
{
|
||||
gfloat xalign;
|
||||
gfloat yalign;
|
||||
|
||||
gint width;
|
||||
gint height;
|
||||
|
||||
guint16 xpad;
|
||||
guint16 ypad;
|
||||
|
||||
guint mode : 2;
|
||||
guint visible : 1;
|
||||
guint is_expander : 1;
|
||||
guint is_expanded : 1;
|
||||
guint cell_background_set : 1;
|
||||
guint sensitive : 1;
|
||||
guint editing : 1;
|
||||
|
||||
GdkColor cell_background;
|
||||
};
|
||||
|
||||
@@ -79,18 +93,25 @@ G_DEFINE_ABSTRACT_TYPE (GtkCellRenderer, gtk_cell_renderer, GTK_TYPE_OBJECT)
|
||||
static void
|
||||
gtk_cell_renderer_init (GtkCellRenderer *cell)
|
||||
{
|
||||
cell->mode = GTK_CELL_RENDERER_MODE_INERT;
|
||||
cell->visible = TRUE;
|
||||
cell->width = -1;
|
||||
cell->height = -1;
|
||||
cell->xalign = 0.5;
|
||||
cell->yalign = 0.5;
|
||||
cell->xpad = 0;
|
||||
cell->ypad = 0;
|
||||
cell->sensitive = TRUE;
|
||||
cell->is_expander = FALSE;
|
||||
cell->is_expanded = FALSE;
|
||||
cell->editing = FALSE;
|
||||
GtkCellRendererPriv *priv;
|
||||
|
||||
cell->priv = G_TYPE_INSTANCE_GET_PRIVATE (cell,
|
||||
GTK_TYPE_CELL_RENDERER,
|
||||
GtkCellRendererPriv);
|
||||
priv = cell->priv;
|
||||
|
||||
priv->mode = GTK_CELL_RENDERER_MODE_INERT;
|
||||
priv->visible = TRUE;
|
||||
priv->width = -1;
|
||||
priv->height = -1;
|
||||
priv->xalign = 0.5;
|
||||
priv->yalign = 0.5;
|
||||
priv->xpad = 0;
|
||||
priv->ypad = 0;
|
||||
priv->sensitive = TRUE;
|
||||
priv->is_expander = FALSE;
|
||||
priv->is_expanded = FALSE;
|
||||
priv->editing = FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -303,7 +324,7 @@ gtk_cell_renderer_class_init (GtkCellRendererClass *class)
|
||||
P_("Cell background set"),
|
||||
P_("Whether this tag affects the cell background color"));
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (GtkCellRendererPrivate));
|
||||
g_type_class_add_private (class, sizeof (GtkCellRendererPriv));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -313,45 +334,45 @@ gtk_cell_renderer_get_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkCellRenderer *cell = GTK_CELL_RENDERER (object);
|
||||
GtkCellRendererPrivate *priv = GTK_CELL_RENDERER_GET_PRIVATE (object);
|
||||
GtkCellRendererPriv *priv = cell->priv;
|
||||
|
||||
switch (param_id)
|
||||
{
|
||||
case PROP_MODE:
|
||||
g_value_set_enum (value, cell->mode);
|
||||
g_value_set_enum (value, priv->mode);
|
||||
break;
|
||||
case PROP_VISIBLE:
|
||||
g_value_set_boolean (value, cell->visible);
|
||||
g_value_set_boolean (value, priv->visible);
|
||||
break;
|
||||
case PROP_SENSITIVE:
|
||||
g_value_set_boolean (value, cell->sensitive);
|
||||
g_value_set_boolean (value, priv->sensitive);
|
||||
break;
|
||||
case PROP_EDITING:
|
||||
g_value_set_boolean (value, cell->editing);
|
||||
g_value_set_boolean (value, priv->editing);
|
||||
break;
|
||||
case PROP_XALIGN:
|
||||
g_value_set_float (value, cell->xalign);
|
||||
g_value_set_float (value, priv->xalign);
|
||||
break;
|
||||
case PROP_YALIGN:
|
||||
g_value_set_float (value, cell->yalign);
|
||||
g_value_set_float (value, priv->yalign);
|
||||
break;
|
||||
case PROP_XPAD:
|
||||
g_value_set_uint (value, cell->xpad);
|
||||
g_value_set_uint (value, priv->xpad);
|
||||
break;
|
||||
case PROP_YPAD:
|
||||
g_value_set_uint (value, cell->ypad);
|
||||
g_value_set_uint (value, priv->ypad);
|
||||
break;
|
||||
case PROP_WIDTH:
|
||||
g_value_set_int (value, cell->width);
|
||||
g_value_set_int (value, priv->width);
|
||||
break;
|
||||
case PROP_HEIGHT:
|
||||
g_value_set_int (value, cell->height);
|
||||
g_value_set_int (value, priv->height);
|
||||
break;
|
||||
case PROP_IS_EXPANDER:
|
||||
g_value_set_boolean (value, cell->is_expander);
|
||||
g_value_set_boolean (value, priv->is_expander);
|
||||
break;
|
||||
case PROP_IS_EXPANDED:
|
||||
g_value_set_boolean (value, cell->is_expanded);
|
||||
g_value_set_boolean (value, priv->is_expanded);
|
||||
break;
|
||||
case PROP_CELL_BACKGROUND_GDK:
|
||||
{
|
||||
@@ -365,7 +386,7 @@ gtk_cell_renderer_get_property (GObject *object,
|
||||
}
|
||||
break;
|
||||
case PROP_CELL_BACKGROUND_SET:
|
||||
g_value_set_boolean (value, cell->cell_background_set);
|
||||
g_value_set_boolean (value, priv->cell_background_set);
|
||||
break;
|
||||
case PROP_CELL_BACKGROUND:
|
||||
default:
|
||||
@@ -382,44 +403,45 @@ gtk_cell_renderer_set_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkCellRenderer *cell = GTK_CELL_RENDERER (object);
|
||||
GtkCellRendererPriv *priv = cell->priv;
|
||||
|
||||
switch (param_id)
|
||||
{
|
||||
case PROP_MODE:
|
||||
cell->mode = g_value_get_enum (value);
|
||||
priv->mode = g_value_get_enum (value);
|
||||
break;
|
||||
case PROP_VISIBLE:
|
||||
cell->visible = g_value_get_boolean (value);
|
||||
priv->visible = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_SENSITIVE:
|
||||
cell->sensitive = g_value_get_boolean (value);
|
||||
priv->sensitive = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_EDITING:
|
||||
cell->editing = g_value_get_boolean (value);
|
||||
priv->editing = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_XALIGN:
|
||||
cell->xalign = g_value_get_float (value);
|
||||
priv->xalign = g_value_get_float (value);
|
||||
break;
|
||||
case PROP_YALIGN:
|
||||
cell->yalign = g_value_get_float (value);
|
||||
priv->yalign = g_value_get_float (value);
|
||||
break;
|
||||
case PROP_XPAD:
|
||||
cell->xpad = g_value_get_uint (value);
|
||||
priv->xpad = g_value_get_uint (value);
|
||||
break;
|
||||
case PROP_YPAD:
|
||||
cell->ypad = g_value_get_uint (value);
|
||||
priv->ypad = g_value_get_uint (value);
|
||||
break;
|
||||
case PROP_WIDTH:
|
||||
cell->width = g_value_get_int (value);
|
||||
priv->width = g_value_get_int (value);
|
||||
break;
|
||||
case PROP_HEIGHT:
|
||||
cell->height = g_value_get_int (value);
|
||||
priv->height = g_value_get_int (value);
|
||||
break;
|
||||
case PROP_IS_EXPANDER:
|
||||
cell->is_expander = g_value_get_boolean (value);
|
||||
priv->is_expander = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_IS_EXPANDED:
|
||||
cell->is_expanded = g_value_get_boolean (value);
|
||||
priv->is_expanded = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_CELL_BACKGROUND:
|
||||
{
|
||||
@@ -439,7 +461,7 @@ gtk_cell_renderer_set_property (GObject *object,
|
||||
set_cell_bg_color (cell, g_value_get_boxed (value));
|
||||
break;
|
||||
case PROP_CELL_BACKGROUND_SET:
|
||||
cell->cell_background_set = g_value_get_boolean (value);
|
||||
priv->cell_background_set = g_value_get_boolean (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
||||
@@ -451,13 +473,13 @@ static void
|
||||
set_cell_bg_color (GtkCellRenderer *cell,
|
||||
GdkColor *color)
|
||||
{
|
||||
GtkCellRendererPrivate *priv = GTK_CELL_RENDERER_GET_PRIVATE (cell);
|
||||
GtkCellRendererPriv *priv = cell->priv;
|
||||
|
||||
if (color)
|
||||
{
|
||||
if (!cell->cell_background_set)
|
||||
if (!priv->cell_background_set)
|
||||
{
|
||||
cell->cell_background_set = TRUE;
|
||||
priv->cell_background_set = TRUE;
|
||||
g_object_notify (G_OBJECT (cell), "cell-background-set");
|
||||
}
|
||||
|
||||
@@ -467,9 +489,9 @@ set_cell_bg_color (GtkCellRenderer *cell,
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cell->cell_background_set)
|
||||
if (priv->cell_background_set)
|
||||
{
|
||||
cell->cell_background_set = FALSE;
|
||||
priv->cell_background_set = FALSE;
|
||||
g_object_notify (G_OBJECT (cell), "cell-background-set");
|
||||
}
|
||||
}
|
||||
@@ -502,21 +524,24 @@ gtk_cell_renderer_get_size (GtkCellRenderer *cell,
|
||||
gint *width,
|
||||
gint *height)
|
||||
{
|
||||
GtkCellRendererPriv *priv;
|
||||
gint *real_width = width;
|
||||
gint *real_height = height;
|
||||
|
||||
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
||||
g_return_if_fail (GTK_CELL_RENDERER_GET_CLASS (cell)->get_size != NULL);
|
||||
|
||||
if (width && cell->width != -1)
|
||||
priv = cell->priv;
|
||||
|
||||
if (width && priv->width != -1)
|
||||
{
|
||||
real_width = NULL;
|
||||
*width = cell->width;
|
||||
*width = priv->width;
|
||||
}
|
||||
if (height && cell->height != -1)
|
||||
if (height && priv->height != -1)
|
||||
{
|
||||
real_height = NULL;
|
||||
*height = cell->height;
|
||||
*height = priv->height;
|
||||
}
|
||||
|
||||
GTK_CELL_RENDERER_GET_CLASS (cell)->get_size (cell,
|
||||
@@ -557,14 +582,14 @@ gtk_cell_renderer_render (GtkCellRenderer *cell,
|
||||
GtkCellRendererState flags)
|
||||
{
|
||||
gboolean selected = FALSE;
|
||||
GtkCellRendererPrivate *priv = GTK_CELL_RENDERER_GET_PRIVATE (cell);
|
||||
GtkCellRendererPriv *priv = cell->priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
||||
g_return_if_fail (GTK_CELL_RENDERER_GET_CLASS (cell)->render != NULL);
|
||||
|
||||
selected = (flags & GTK_CELL_RENDERER_SELECTED) == GTK_CELL_RENDERER_SELECTED;
|
||||
|
||||
if (cell->cell_background_set && !selected)
|
||||
if (priv->cell_background_set && !selected)
|
||||
{
|
||||
cairo_t *cr = gdk_cairo_create (window);
|
||||
|
||||
@@ -610,9 +635,13 @@ gtk_cell_renderer_activate (GtkCellRenderer *cell,
|
||||
const GdkRectangle *cell_area,
|
||||
GtkCellRendererState flags)
|
||||
{
|
||||
GtkCellRendererPriv *priv;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_CELL_RENDERER (cell), FALSE);
|
||||
|
||||
if (cell->mode != GTK_CELL_RENDERER_MODE_ACTIVATABLE)
|
||||
priv = cell->priv;
|
||||
|
||||
if (priv->mode != GTK_CELL_RENDERER_MODE_ACTIVATABLE)
|
||||
return FALSE;
|
||||
|
||||
if (GTK_CELL_RENDERER_GET_CLASS (cell)->activate == NULL)
|
||||
@@ -652,11 +681,14 @@ gtk_cell_renderer_start_editing (GtkCellRenderer *cell,
|
||||
GtkCellRendererState flags)
|
||||
|
||||
{
|
||||
GtkCellRendererPriv *priv;
|
||||
GtkCellEditable *editable;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_CELL_RENDERER (cell), NULL);
|
||||
|
||||
if (cell->mode != GTK_CELL_RENDERER_MODE_EDITABLE)
|
||||
priv = cell->priv;
|
||||
|
||||
if (priv->mode != GTK_CELL_RENDERER_MODE_EDITABLE)
|
||||
return NULL;
|
||||
|
||||
if (GTK_CELL_RENDERER_GET_CLASS (cell)->start_editing == NULL)
|
||||
@@ -674,7 +706,7 @@ gtk_cell_renderer_start_editing (GtkCellRenderer *cell,
|
||||
cell_renderer_signals[EDITING_STARTED], 0,
|
||||
editable, path);
|
||||
|
||||
cell->editing = TRUE;
|
||||
priv->editing = TRUE;
|
||||
|
||||
return editable;
|
||||
}
|
||||
@@ -692,22 +724,26 @@ gtk_cell_renderer_set_fixed_size (GtkCellRenderer *cell,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
GtkCellRendererPriv *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
||||
g_return_if_fail (width >= -1 && height >= -1);
|
||||
|
||||
if ((width != cell->width) || (height != cell->height))
|
||||
priv = cell->priv;
|
||||
|
||||
if ((width != priv->width) || (height != priv->height))
|
||||
{
|
||||
g_object_freeze_notify (G_OBJECT (cell));
|
||||
|
||||
if (width != cell->width)
|
||||
if (width != priv->width)
|
||||
{
|
||||
cell->width = width;
|
||||
priv->width = width;
|
||||
g_object_notify (G_OBJECT (cell), "width");
|
||||
}
|
||||
|
||||
if (height != cell->height)
|
||||
if (height != priv->height)
|
||||
{
|
||||
cell->height = height;
|
||||
priv->height = height;
|
||||
g_object_notify (G_OBJECT (cell), "height");
|
||||
}
|
||||
|
||||
@@ -728,12 +764,16 @@ gtk_cell_renderer_get_fixed_size (GtkCellRenderer *cell,
|
||||
gint *width,
|
||||
gint *height)
|
||||
{
|
||||
GtkCellRendererPriv *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
||||
|
||||
priv = cell->priv;
|
||||
|
||||
if (width)
|
||||
*width = cell->width;
|
||||
*width = priv->width;
|
||||
if (height)
|
||||
*height = cell->height;
|
||||
*height = priv->height;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -751,23 +791,27 @@ gtk_cell_renderer_set_alignment (GtkCellRenderer *cell,
|
||||
gfloat xalign,
|
||||
gfloat yalign)
|
||||
{
|
||||
GtkCellRendererPriv *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
||||
g_return_if_fail (xalign >= 0.0 && xalign <= 1.0);
|
||||
g_return_if_fail (yalign >= 0.0 && yalign <= 1.0);
|
||||
|
||||
if ((xalign != cell->xalign) || (yalign != cell->yalign))
|
||||
priv = cell->priv;
|
||||
|
||||
if ((xalign != priv->xalign) || (yalign != priv->yalign))
|
||||
{
|
||||
g_object_freeze_notify (G_OBJECT (cell));
|
||||
|
||||
if (xalign != cell->xalign)
|
||||
if (xalign != priv->xalign)
|
||||
{
|
||||
cell->xalign = xalign;
|
||||
priv->xalign = xalign;
|
||||
g_object_notify (G_OBJECT (cell), "xalign");
|
||||
}
|
||||
|
||||
if (yalign != cell->yalign)
|
||||
if (yalign != priv->yalign)
|
||||
{
|
||||
cell->yalign = yalign;
|
||||
priv->yalign = yalign;
|
||||
g_object_notify (G_OBJECT (cell), "yalign");
|
||||
}
|
||||
|
||||
@@ -790,12 +834,16 @@ gtk_cell_renderer_get_alignment (GtkCellRenderer *cell,
|
||||
gfloat *xalign,
|
||||
gfloat *yalign)
|
||||
{
|
||||
GtkCellRendererPriv *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
||||
|
||||
priv = cell->priv;
|
||||
|
||||
if (xalign)
|
||||
*xalign = cell->xalign;
|
||||
*xalign = priv->xalign;
|
||||
if (yalign)
|
||||
*yalign = cell->yalign;
|
||||
*yalign = priv->yalign;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -813,22 +861,26 @@ gtk_cell_renderer_set_padding (GtkCellRenderer *cell,
|
||||
gint xpad,
|
||||
gint ypad)
|
||||
{
|
||||
GtkCellRendererPriv *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
||||
g_return_if_fail (xpad >= 0 && xpad >= 0);
|
||||
|
||||
if ((xpad != cell->xpad) || (ypad != cell->ypad))
|
||||
priv = cell->priv;
|
||||
|
||||
if ((xpad != priv->xpad) || (ypad != priv->ypad))
|
||||
{
|
||||
g_object_freeze_notify (G_OBJECT (cell));
|
||||
|
||||
if (xpad != cell->xpad)
|
||||
if (xpad != priv->xpad)
|
||||
{
|
||||
cell->xpad = xpad;
|
||||
priv->xpad = xpad;
|
||||
g_object_notify (G_OBJECT (cell), "xpad");
|
||||
}
|
||||
|
||||
if (ypad != cell->ypad)
|
||||
if (ypad != priv->ypad)
|
||||
{
|
||||
cell->ypad = ypad;
|
||||
priv->ypad = ypad;
|
||||
g_object_notify (G_OBJECT (cell), "ypad");
|
||||
}
|
||||
|
||||
@@ -851,12 +903,16 @@ gtk_cell_renderer_get_padding (GtkCellRenderer *cell,
|
||||
gint *xpad,
|
||||
gint *ypad)
|
||||
{
|
||||
GtkCellRendererPriv *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
||||
|
||||
priv = cell->priv;
|
||||
|
||||
if (xpad)
|
||||
*xpad = cell->xpad;
|
||||
*xpad = priv->xpad;
|
||||
if (ypad)
|
||||
*ypad = cell->ypad;
|
||||
*ypad = priv->ypad;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -872,11 +928,15 @@ void
|
||||
gtk_cell_renderer_set_visible (GtkCellRenderer *cell,
|
||||
gboolean visible)
|
||||
{
|
||||
GtkCellRendererPriv *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
||||
|
||||
if (cell->visible != visible)
|
||||
priv = cell->priv;
|
||||
|
||||
if (priv->visible != visible)
|
||||
{
|
||||
cell->visible = visible ? TRUE : FALSE;
|
||||
priv->visible = visible ? TRUE : FALSE;
|
||||
g_object_notify (G_OBJECT (cell), "visible");
|
||||
}
|
||||
}
|
||||
@@ -896,7 +956,7 @@ gtk_cell_renderer_get_visible (GtkCellRenderer *cell)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_CELL_RENDERER (cell), FALSE);
|
||||
|
||||
return cell->visible;
|
||||
return cell->priv->visible;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -912,11 +972,15 @@ void
|
||||
gtk_cell_renderer_set_sensitive (GtkCellRenderer *cell,
|
||||
gboolean sensitive)
|
||||
{
|
||||
GtkCellRendererPriv *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
||||
|
||||
if (cell->sensitive != sensitive)
|
||||
priv = cell->priv;
|
||||
|
||||
if (priv->sensitive != sensitive)
|
||||
{
|
||||
cell->sensitive = sensitive ? TRUE : FALSE;
|
||||
priv->sensitive = sensitive ? TRUE : FALSE;
|
||||
g_object_notify (G_OBJECT (cell), "sensitive");
|
||||
}
|
||||
}
|
||||
@@ -936,7 +1000,7 @@ gtk_cell_renderer_get_sensitive (GtkCellRenderer *cell)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_CELL_RENDERER (cell), FALSE);
|
||||
|
||||
return cell->sensitive;
|
||||
return cell->priv->sensitive;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -958,11 +1022,15 @@ void
|
||||
gtk_cell_renderer_stop_editing (GtkCellRenderer *cell,
|
||||
gboolean canceled)
|
||||
{
|
||||
GtkCellRendererPriv *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
||||
|
||||
if (cell->editing)
|
||||
priv = cell->priv;
|
||||
|
||||
if (priv->editing)
|
||||
{
|
||||
cell->editing = FALSE;
|
||||
priv->editing = FALSE;
|
||||
if (canceled)
|
||||
g_signal_emit (cell, cell_renderer_signals[EDITING_CANCELED], 0);
|
||||
}
|
||||
|
||||
@@ -52,29 +52,16 @@ typedef enum
|
||||
#define GTK_IS_CELL_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CELL_RENDERER))
|
||||
#define GTK_CELL_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CELL_RENDERER, GtkCellRendererClass))
|
||||
|
||||
typedef struct _GtkCellRenderer GtkCellRenderer;
|
||||
typedef struct _GtkCellRenderer GtkCellRenderer;
|
||||
typedef struct _GtkCellRendererPriv GtkCellRendererPriv;
|
||||
typedef struct _GtkCellRendererClass GtkCellRendererClass;
|
||||
|
||||
struct _GtkCellRenderer
|
||||
{
|
||||
GtkObject parent;
|
||||
|
||||
gfloat GSEAL (xalign);
|
||||
gfloat GSEAL (yalign);
|
||||
|
||||
gint GSEAL (width);
|
||||
gint GSEAL (height);
|
||||
|
||||
guint16 GSEAL (xpad);
|
||||
guint16 GSEAL (ypad);
|
||||
|
||||
guint GSEAL (mode) : 2;
|
||||
guint GSEAL (visible) : 1;
|
||||
guint GSEAL (is_expander) : 1;
|
||||
guint GSEAL (is_expanded) : 1;
|
||||
guint GSEAL (cell_background_set) : 1;
|
||||
guint GSEAL (sensitive) : 1;
|
||||
guint GSEAL (editing) : 1;
|
||||
/* <private> */
|
||||
GtkCellRendererPriv *priv;
|
||||
};
|
||||
|
||||
struct _GtkCellRendererClass
|
||||
|
||||
@@ -29,8 +29,6 @@
|
||||
#include "gdk/gdkkeysyms.h"
|
||||
|
||||
|
||||
#define GTK_CELL_RENDERER_ACCEL_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GTK_TYPE_CELL_RENDERER_ACCEL, GtkCellRendererAccelPrivate))
|
||||
|
||||
static void gtk_cell_renderer_accel_get_property (GObject *object,
|
||||
guint param_id,
|
||||
GValue *value,
|
||||
@@ -73,12 +71,21 @@ enum {
|
||||
PROP_ACCEL_MODE
|
||||
};
|
||||
|
||||
typedef struct GtkCellRendererAccelPrivate GtkCellRendererAccelPrivate;
|
||||
|
||||
struct GtkCellRendererAccelPrivate
|
||||
struct _GtkCellRendererAccelPriv
|
||||
{
|
||||
GtkCellRendererAccelMode accel_mode;
|
||||
|
||||
GtkWidget *edit_widget;
|
||||
GtkWidget *grab_widget;
|
||||
GtkWidget *sizing_label;
|
||||
|
||||
GdkDevice *grab_keyboard;
|
||||
GdkDevice *grab_pointer;
|
||||
|
||||
GdkModifierType accel_mods;
|
||||
|
||||
guint accel_key;
|
||||
guint keycode;
|
||||
};
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
@@ -90,6 +97,10 @@ gtk_cell_renderer_accel_init (GtkCellRendererAccel *cell_accel)
|
||||
{
|
||||
gchar *text;
|
||||
|
||||
cell_accel->priv = G_TYPE_INSTANCE_GET_PRIVATE (cell_accel,
|
||||
GTK_TYPE_CELL_RENDERER_ACCEL,
|
||||
GtkCellRendererAccelPriv);
|
||||
|
||||
text = convert_keysym_state_to_string (cell_accel, 0, 0, 0);
|
||||
g_object_set (cell_accel, "text", text, NULL);
|
||||
g_free (text);
|
||||
@@ -223,7 +234,7 @@ gtk_cell_renderer_accel_class_init (GtkCellRendererAccelClass *cell_accel_class)
|
||||
G_TYPE_NONE, 1,
|
||||
G_TYPE_STRING);
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (GtkCellRendererAccelPrivate));
|
||||
g_type_class_add_private (cell_accel_class, sizeof (GtkCellRendererAccelPriv));
|
||||
}
|
||||
|
||||
|
||||
@@ -248,6 +259,8 @@ convert_keysym_state_to_string (GtkCellRendererAccel *accel,
|
||||
GdkModifierType mask,
|
||||
guint keycode)
|
||||
{
|
||||
GtkCellRendererAccelPriv *priv = accel->priv;
|
||||
|
||||
if (keysym == 0 && keycode == 0)
|
||||
/* This label is displayed in a treeview cell displaying
|
||||
* a disabled accelerator key combination.
|
||||
@@ -255,7 +268,7 @@ convert_keysym_state_to_string (GtkCellRendererAccel *accel,
|
||||
return g_strdup (C_("Accelerator", "Disabled"));
|
||||
else
|
||||
{
|
||||
if (accel->accel_mode == GTK_CELL_RENDERER_ACCEL_MODE_GTK)
|
||||
if (priv->accel_mode == GTK_CELL_RENDERER_ACCEL_MODE_GTK)
|
||||
{
|
||||
if (!gtk_accelerator_valid (keysym, mask))
|
||||
/* This label is displayed in a treeview cell displaying
|
||||
@@ -294,24 +307,24 @@ gtk_cell_renderer_accel_get_property (GObject *object,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkCellRendererAccel *accel = GTK_CELL_RENDERER_ACCEL (object);
|
||||
GtkCellRendererAccelPriv *priv = GTK_CELL_RENDERER_ACCEL (object)->priv;
|
||||
|
||||
switch (param_id)
|
||||
{
|
||||
case PROP_ACCEL_KEY:
|
||||
g_value_set_uint (value, accel->accel_key);
|
||||
g_value_set_uint (value, priv->accel_key);
|
||||
break;
|
||||
|
||||
case PROP_ACCEL_MODS:
|
||||
g_value_set_flags (value, accel->accel_mods);
|
||||
g_value_set_flags (value, priv->accel_mods);
|
||||
break;
|
||||
|
||||
case PROP_KEYCODE:
|
||||
g_value_set_uint (value, accel->keycode);
|
||||
g_value_set_uint (value, priv->keycode);
|
||||
break;
|
||||
|
||||
case PROP_ACCEL_MODE:
|
||||
g_value_set_enum (value, accel->accel_mode);
|
||||
g_value_set_enum (value, priv->accel_mode);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -326,6 +339,7 @@ gtk_cell_renderer_accel_set_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkCellRendererAccel *accel = GTK_CELL_RENDERER_ACCEL (object);
|
||||
GtkCellRendererAccelPriv *priv = accel->priv;
|
||||
gboolean changed = FALSE;
|
||||
|
||||
switch (param_id)
|
||||
@@ -334,9 +348,9 @@ gtk_cell_renderer_accel_set_property (GObject *object,
|
||||
{
|
||||
guint accel_key = g_value_get_uint (value);
|
||||
|
||||
if (accel->accel_key != accel_key)
|
||||
if (priv->accel_key != accel_key)
|
||||
{
|
||||
accel->accel_key = accel_key;
|
||||
priv->accel_key = accel_key;
|
||||
changed = TRUE;
|
||||
}
|
||||
}
|
||||
@@ -346,9 +360,9 @@ gtk_cell_renderer_accel_set_property (GObject *object,
|
||||
{
|
||||
guint accel_mods = g_value_get_flags (value);
|
||||
|
||||
if (accel->accel_mods != accel_mods)
|
||||
if (priv->accel_mods != accel_mods)
|
||||
{
|
||||
accel->accel_mods = accel_mods;
|
||||
priv->accel_mods = accel_mods;
|
||||
changed = TRUE;
|
||||
}
|
||||
}
|
||||
@@ -357,16 +371,16 @@ gtk_cell_renderer_accel_set_property (GObject *object,
|
||||
{
|
||||
guint keycode = g_value_get_uint (value);
|
||||
|
||||
if (accel->keycode != keycode)
|
||||
if (priv->keycode != keycode)
|
||||
{
|
||||
accel->keycode = keycode;
|
||||
priv->keycode = keycode;
|
||||
changed = TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_ACCEL_MODE:
|
||||
accel->accel_mode = g_value_get_enum (value);
|
||||
priv->accel_mode = g_value_get_enum (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -377,7 +391,7 @@ gtk_cell_renderer_accel_set_property (GObject *object,
|
||||
{
|
||||
gchar *text;
|
||||
|
||||
text = convert_keysym_state_to_string (accel, accel->accel_key, accel->accel_mods, accel->keycode);
|
||||
text = convert_keysym_state_to_string (accel, priv->accel_key, priv->accel_mods, priv->keycode);
|
||||
g_object_set (accel, "text", text, NULL);
|
||||
g_free (text);
|
||||
}
|
||||
@@ -393,13 +407,13 @@ gtk_cell_renderer_accel_get_size (GtkCellRenderer *cell,
|
||||
gint *height)
|
||||
|
||||
{
|
||||
GtkCellRendererAccel *accel = (GtkCellRendererAccel *) cell;
|
||||
GtkCellRendererAccelPriv *priv = GTK_CELL_RENDERER_ACCEL (cell)->priv;
|
||||
GtkRequisition requisition;
|
||||
|
||||
if (accel->sizing_label == NULL)
|
||||
accel->sizing_label = gtk_label_new (_("New accelerator..."));
|
||||
if (priv->sizing_label == NULL)
|
||||
priv->sizing_label = gtk_label_new (_("New accelerator..."));
|
||||
|
||||
gtk_widget_size_request (accel->sizing_label, &requisition);
|
||||
gtk_widget_size_request (priv->sizing_label, &requisition);
|
||||
|
||||
GTK_CELL_RENDERER_CLASS (gtk_cell_renderer_accel_parent_class)->get_size (cell, widget, cell_area,
|
||||
x_offset, y_offset, width, height);
|
||||
@@ -416,7 +430,7 @@ grab_key_callback (GtkWidget *widget,
|
||||
GdkEventKey *event,
|
||||
GtkCellRendererAccel *accel)
|
||||
{
|
||||
GtkCellRendererAccelPrivate *priv;
|
||||
GtkCellRendererAccelPriv *priv = accel->priv;
|
||||
GdkModifierType accel_mods = 0;
|
||||
guint accel_key;
|
||||
gchar *path;
|
||||
@@ -425,7 +439,6 @@ grab_key_callback (GtkWidget *widget,
|
||||
GdkModifierType consumed_modifiers;
|
||||
GdkDisplay *display;
|
||||
|
||||
priv = GTK_CELL_RENDERER_ACCEL_GET_PRIVATE (accel);
|
||||
display = gtk_widget_get_display (widget);
|
||||
|
||||
if (event->is_modifier)
|
||||
@@ -448,7 +461,7 @@ grab_key_callback (GtkWidget *widget,
|
||||
|
||||
/* Filter consumed modifiers
|
||||
*/
|
||||
if (accel->accel_mode == GTK_CELL_RENDERER_ACCEL_MODE_GTK)
|
||||
if (priv->accel_mode == GTK_CELL_RENDERER_ACCEL_MODE_GTK)
|
||||
accel_mods &= ~consumed_modifiers;
|
||||
|
||||
/* Put shift back if it changed the case of the key, not otherwise.
|
||||
@@ -471,7 +484,7 @@ grab_key_callback (GtkWidget *widget,
|
||||
}
|
||||
}
|
||||
|
||||
if (accel->accel_mode == GTK_CELL_RENDERER_ACCEL_MODE_GTK)
|
||||
if (priv->accel_mode == GTK_CELL_RENDERER_ACCEL_MODE_GTK)
|
||||
{
|
||||
if (!gtk_accelerator_valid (accel_key, accel_mods))
|
||||
{
|
||||
@@ -484,16 +497,16 @@ grab_key_callback (GtkWidget *widget,
|
||||
edited = TRUE;
|
||||
|
||||
out:
|
||||
gtk_device_grab_remove (accel->grab_widget, priv->grab_pointer);
|
||||
gtk_device_grab_remove (priv->grab_widget, priv->grab_pointer);
|
||||
gdk_device_ungrab (priv->grab_keyboard, event->time);
|
||||
gdk_device_ungrab (priv->grab_pointer, event->time);
|
||||
|
||||
path = g_strdup (g_object_get_data (G_OBJECT (accel->edit_widget), "gtk-cell-renderer-text"));
|
||||
path = g_strdup (g_object_get_data (G_OBJECT (priv->edit_widget), "gtk-cell-renderer-text"));
|
||||
|
||||
gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (accel->edit_widget));
|
||||
gtk_cell_editable_remove_widget (GTK_CELL_EDITABLE (accel->edit_widget));
|
||||
accel->edit_widget = NULL;
|
||||
accel->grab_widget = NULL;
|
||||
gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (priv->edit_widget));
|
||||
gtk_cell_editable_remove_widget (GTK_CELL_EDITABLE (priv->edit_widget));
|
||||
priv->edit_widget = NULL;
|
||||
priv->grab_widget = NULL;
|
||||
priv->grab_keyboard = NULL;
|
||||
priv->grab_pointer = NULL;
|
||||
|
||||
@@ -512,18 +525,16 @@ static void
|
||||
ungrab_stuff (GtkWidget *widget,
|
||||
GtkCellRendererAccel *accel)
|
||||
{
|
||||
GtkCellRendererAccelPrivate *priv;
|
||||
GtkCellRendererAccelPriv *priv = accel->priv;
|
||||
|
||||
priv = GTK_CELL_RENDERER_ACCEL_GET_PRIVATE (accel);
|
||||
|
||||
gtk_device_grab_remove (accel->grab_widget, priv->grab_pointer);
|
||||
gtk_device_grab_remove (priv->grab_widget, priv->grab_pointer);
|
||||
gdk_device_ungrab (priv->grab_keyboard, GDK_CURRENT_TIME);
|
||||
gdk_device_ungrab (priv->grab_pointer, GDK_CURRENT_TIME);
|
||||
|
||||
priv->grab_keyboard = NULL;
|
||||
priv->grab_pointer = NULL;
|
||||
|
||||
g_signal_handlers_disconnect_by_func (G_OBJECT (accel->grab_widget),
|
||||
g_signal_handlers_disconnect_by_func (priv->grab_widget,
|
||||
G_CALLBACK (grab_key_callback),
|
||||
accel);
|
||||
}
|
||||
@@ -568,20 +579,22 @@ gtk_cell_renderer_accel_start_editing (GtkCellRenderer *cell,
|
||||
GdkRectangle *cell_area,
|
||||
GtkCellRendererState flags)
|
||||
{
|
||||
GtkCellRendererAccelPrivate *priv;
|
||||
GtkCellRendererAccelPriv *priv;
|
||||
GtkCellRendererText *celltext;
|
||||
GtkCellRendererAccel *accel;
|
||||
GtkWidget *label;
|
||||
GtkWidget *eventbox;
|
||||
GdkDevice *device, *keyb, *pointer;
|
||||
gboolean editable;
|
||||
guint32 time;
|
||||
|
||||
celltext = GTK_CELL_RENDERER_TEXT (cell);
|
||||
accel = GTK_CELL_RENDERER_ACCEL (cell);
|
||||
priv = GTK_CELL_RENDERER_ACCEL_GET_PRIVATE (cell);
|
||||
priv = accel->priv;
|
||||
|
||||
/* If the cell isn't editable we return NULL. */
|
||||
if (celltext->editable == FALSE)
|
||||
g_object_get (celltext, "editable", &editable, NULL);
|
||||
if (editable == FALSE)
|
||||
return NULL;
|
||||
|
||||
g_return_val_if_fail (widget->window != NULL, NULL);
|
||||
@@ -624,16 +637,16 @@ gtk_cell_renderer_accel_start_editing (GtkCellRenderer *cell,
|
||||
|
||||
priv->grab_keyboard = keyb;
|
||||
priv->grab_pointer = pointer;
|
||||
accel->grab_widget = widget;
|
||||
priv->grab_widget = widget;
|
||||
|
||||
g_signal_connect (G_OBJECT (widget), "key-press-event",
|
||||
G_CALLBACK (grab_key_callback),
|
||||
accel);
|
||||
|
||||
eventbox = g_object_new (_gtk_cell_editable_event_box_get_type (), NULL);
|
||||
accel->edit_widget = eventbox;
|
||||
g_object_add_weak_pointer (G_OBJECT (accel->edit_widget),
|
||||
(gpointer) &accel->edit_widget);
|
||||
priv->edit_widget = eventbox;
|
||||
g_object_add_weak_pointer (G_OBJECT (priv->edit_widget),
|
||||
(gpointer) &priv->edit_widget);
|
||||
|
||||
label = gtk_label_new (NULL);
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
@@ -652,15 +665,15 @@ gtk_cell_renderer_accel_start_editing (GtkCellRenderer *cell,
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (eventbox), label);
|
||||
|
||||
g_object_set_data_full (G_OBJECT (accel->edit_widget), "gtk-cell-renderer-text",
|
||||
g_object_set_data_full (G_OBJECT (priv->edit_widget), "gtk-cell-renderer-text",
|
||||
g_strdup (path), g_free);
|
||||
|
||||
gtk_widget_show_all (accel->edit_widget);
|
||||
gtk_widget_show_all (priv->edit_widget);
|
||||
|
||||
gtk_device_grab_add (accel->grab_widget, pointer, TRUE);
|
||||
gtk_device_grab_add (priv->grab_widget, pointer, TRUE);
|
||||
|
||||
g_signal_connect (G_OBJECT (accel->edit_widget), "unrealize",
|
||||
g_signal_connect (priv->edit_widget, "unrealize",
|
||||
G_CALLBACK (ungrab_stuff), accel);
|
||||
|
||||
return GTK_CELL_EDITABLE (accel->edit_widget);
|
||||
return GTK_CELL_EDITABLE (priv->edit_widget);
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ G_BEGIN_DECLS
|
||||
#define GTK_CELL_RENDERER_ACCEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CELL_RENDERER_ACCEL, GtkCellRendererAccelClass))
|
||||
|
||||
typedef struct _GtkCellRendererAccel GtkCellRendererAccel;
|
||||
typedef struct _GtkCellRendererAccelPriv GtkCellRendererAccelPriv;
|
||||
typedef struct _GtkCellRendererAccelClass GtkCellRendererAccelClass;
|
||||
|
||||
|
||||
@@ -51,14 +52,7 @@ struct _GtkCellRendererAccel
|
||||
GtkCellRendererText parent;
|
||||
|
||||
/*< private >*/
|
||||
guint GSEAL (accel_key);
|
||||
GdkModifierType GSEAL (accel_mods);
|
||||
guint GSEAL (keycode);
|
||||
GtkCellRendererAccelMode GSEAL (accel_mode);
|
||||
|
||||
GtkWidget *GSEAL (edit_widget);
|
||||
GtkWidget *GSEAL (grab_widget);
|
||||
GtkWidget *GSEAL (sizing_label);
|
||||
GtkCellRendererAccelPriv *priv;
|
||||
};
|
||||
|
||||
struct _GtkCellRendererAccelClass
|
||||
|
||||
@@ -31,12 +31,17 @@
|
||||
#include "gtkmarshalers.h"
|
||||
#include "gtkprivate.h"
|
||||
|
||||
#define GTK_CELL_RENDERER_COMBO_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_CELL_RENDERER_COMBO, GtkCellRendererComboPrivate))
|
||||
|
||||
typedef struct _GtkCellRendererComboPrivate GtkCellRendererComboPrivate;
|
||||
struct _GtkCellRendererComboPrivate
|
||||
struct _GtkCellRendererComboPriv
|
||||
{
|
||||
GtkTreeModel *model;
|
||||
|
||||
GtkWidget *combo;
|
||||
|
||||
gboolean has_entry;
|
||||
|
||||
gint text_column;
|
||||
|
||||
guint focus_out_id;
|
||||
};
|
||||
|
||||
|
||||
@@ -182,16 +187,23 @@ gtk_cell_renderer_combo_class_init (GtkCellRendererComboClass *klass)
|
||||
G_TYPE_STRING,
|
||||
GTK_TYPE_TREE_ITER);
|
||||
|
||||
g_type_class_add_private (klass, sizeof (GtkCellRendererComboPrivate));
|
||||
g_type_class_add_private (klass, sizeof (GtkCellRendererComboPriv));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_cell_renderer_combo_init (GtkCellRendererCombo *self)
|
||||
{
|
||||
self->model = NULL;
|
||||
self->text_column = -1;
|
||||
self->has_entry = TRUE;
|
||||
self->focus_out_id = 0;
|
||||
GtkCellRendererComboPriv *priv;
|
||||
|
||||
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
|
||||
GTK_TYPE_CELL_RENDERER_COMBO,
|
||||
GtkCellRendererComboPriv);
|
||||
priv = self->priv;
|
||||
|
||||
priv->model = NULL;
|
||||
priv->text_column = -1;
|
||||
priv->has_entry = TRUE;
|
||||
priv->focus_out_id = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -219,11 +231,12 @@ static void
|
||||
gtk_cell_renderer_combo_finalize (GObject *object)
|
||||
{
|
||||
GtkCellRendererCombo *cell = GTK_CELL_RENDERER_COMBO (object);
|
||||
GtkCellRendererComboPriv *priv = cell->priv;
|
||||
|
||||
if (cell->model)
|
||||
if (priv->model)
|
||||
{
|
||||
g_object_unref (cell->model);
|
||||
cell->model = NULL;
|
||||
g_object_unref (priv->model);
|
||||
priv->model = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (gtk_cell_renderer_combo_parent_class)->finalize (object);
|
||||
@@ -236,17 +249,18 @@ gtk_cell_renderer_combo_get_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkCellRendererCombo *cell = GTK_CELL_RENDERER_COMBO (object);
|
||||
GtkCellRendererComboPriv *priv = cell->priv;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_MODEL:
|
||||
g_value_set_object (value, cell->model);
|
||||
g_value_set_object (value, priv->model);
|
||||
break;
|
||||
case PROP_TEXT_COLUMN:
|
||||
g_value_set_int (value, cell->text_column);
|
||||
g_value_set_int (value, priv->text_column);
|
||||
break;
|
||||
case PROP_HAS_ENTRY:
|
||||
g_value_set_boolean (value, cell->has_entry);
|
||||
g_value_set_boolean (value, priv->has_entry);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
@@ -261,27 +275,24 @@ gtk_cell_renderer_combo_set_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkCellRendererCombo *cell = GTK_CELL_RENDERER_COMBO (object);
|
||||
GtkCellRendererComboPriv *priv = cell->priv;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_MODEL:
|
||||
{
|
||||
GtkCellRendererComboPrivate *priv;
|
||||
|
||||
priv = GTK_CELL_RENDERER_COMBO_GET_PRIVATE (cell);
|
||||
|
||||
if (cell->model)
|
||||
g_object_unref (cell->model);
|
||||
cell->model = GTK_TREE_MODEL (g_value_get_object (value));
|
||||
if (cell->model)
|
||||
g_object_ref (cell->model);
|
||||
if (priv->model)
|
||||
g_object_unref (priv->model);
|
||||
priv->model = GTK_TREE_MODEL (g_value_get_object (value));
|
||||
if (priv->model)
|
||||
g_object_ref (priv->model);
|
||||
break;
|
||||
}
|
||||
case PROP_TEXT_COLUMN:
|
||||
cell->text_column = g_value_get_int (value);
|
||||
priv->text_column = g_value_get_int (value);
|
||||
break;
|
||||
case PROP_HAS_ENTRY:
|
||||
cell->has_entry = g_value_get_boolean (value);
|
||||
priv->has_entry = g_value_get_boolean (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
@@ -319,15 +330,15 @@ gtk_cell_renderer_combo_editing_done (GtkCellEditable *combo,
|
||||
GtkCellRendererCombo *cell;
|
||||
GtkEntry *entry;
|
||||
gboolean canceled;
|
||||
GtkCellRendererComboPrivate *priv;
|
||||
GtkCellRendererComboPriv *priv;
|
||||
|
||||
cell = GTK_CELL_RENDERER_COMBO (data);
|
||||
priv = GTK_CELL_RENDERER_COMBO_GET_PRIVATE (data);
|
||||
priv = cell->priv;
|
||||
|
||||
if (cell->focus_out_id > 0)
|
||||
if (priv->focus_out_id > 0)
|
||||
{
|
||||
g_signal_handler_disconnect (combo, cell->focus_out_id);
|
||||
cell->focus_out_id = 0;
|
||||
g_signal_handler_disconnect (combo, priv->focus_out_id);
|
||||
priv->focus_out_id = 0;
|
||||
}
|
||||
|
||||
g_object_get (combo,
|
||||
@@ -351,7 +362,7 @@ gtk_cell_renderer_combo_editing_done (GtkCellEditable *combo,
|
||||
|
||||
if (model
|
||||
&& gtk_combo_box_get_active_iter (GTK_COMBO_BOX (combo), &iter))
|
||||
gtk_tree_model_get (model, &iter, cell->text_column, &new_text, -1);
|
||||
gtk_tree_model_get (model, &iter, priv->text_column, &new_text, -1);
|
||||
}
|
||||
|
||||
path = g_object_get_data (G_OBJECT (combo), GTK_CELL_RENDERER_COMBO_PATH);
|
||||
@@ -386,17 +397,23 @@ find_text (GtkTreeModel *model,
|
||||
GtkTreeIter *iter,
|
||||
gpointer data)
|
||||
{
|
||||
GtkCellRendererComboPriv *priv;
|
||||
SearchData *search_data = (SearchData *)data;
|
||||
gchar *text;
|
||||
gchar *text, *cell_text;
|
||||
|
||||
priv = search_data->cell->priv;
|
||||
|
||||
gtk_tree_model_get (model, iter, search_data->cell->text_column, &text, -1);
|
||||
if (text && GTK_CELL_RENDERER_TEXT (search_data->cell)->text &&
|
||||
strcmp (text, GTK_CELL_RENDERER_TEXT (search_data->cell)->text) == 0)
|
||||
gtk_tree_model_get (model, iter, priv->text_column, &text, -1);
|
||||
g_object_get (GTK_CELL_RENDERER_TEXT (search_data->cell),
|
||||
"text", &cell_text,
|
||||
NULL);
|
||||
if (text && cell_text && g_strcmp0 (text, cell_text) == 0)
|
||||
{
|
||||
search_data->iter = *iter;
|
||||
search_data->found = TRUE;
|
||||
}
|
||||
|
||||
g_free (cell_text);
|
||||
g_free (text);
|
||||
|
||||
return search_data->found;
|
||||
@@ -415,50 +432,55 @@ gtk_cell_renderer_combo_start_editing (GtkCellRenderer *cell,
|
||||
GtkCellRendererText *cell_text;
|
||||
GtkWidget *combo;
|
||||
SearchData search_data;
|
||||
GtkCellRendererComboPrivate *priv;
|
||||
GtkCellRendererComboPriv *priv;
|
||||
gboolean editable;
|
||||
gchar *text;
|
||||
|
||||
cell_text = GTK_CELL_RENDERER_TEXT (cell);
|
||||
if (cell_text->editable == FALSE)
|
||||
g_object_get (cell_text, "editable", &editable, NULL);
|
||||
if (editable == FALSE)
|
||||
return NULL;
|
||||
|
||||
cell_combo = GTK_CELL_RENDERER_COMBO (cell);
|
||||
if (cell_combo->text_column < 0)
|
||||
priv = cell_combo->priv;
|
||||
|
||||
if (priv->text_column < 0)
|
||||
return NULL;
|
||||
|
||||
priv = GTK_CELL_RENDERER_COMBO_GET_PRIVATE (cell_combo);
|
||||
|
||||
if (cell_combo->has_entry)
|
||||
if (priv->has_entry)
|
||||
{
|
||||
combo = gtk_combo_box_entry_new ();
|
||||
|
||||
if (cell_combo->model)
|
||||
gtk_combo_box_set_model (GTK_COMBO_BOX (combo), cell_combo->model);
|
||||
if (priv->model)
|
||||
gtk_combo_box_set_model (GTK_COMBO_BOX (combo), priv->model);
|
||||
gtk_combo_box_entry_set_text_column (GTK_COMBO_BOX_ENTRY (combo),
|
||||
cell_combo->text_column);
|
||||
priv->text_column);
|
||||
|
||||
if (cell_text->text)
|
||||
gtk_entry_set_text (GTK_ENTRY (GTK_BIN (combo)->child),
|
||||
cell_text->text);
|
||||
g_object_get (cell_text, "text", &text, NULL);
|
||||
if (text)
|
||||
gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (combo))),
|
||||
text);
|
||||
g_free (text);
|
||||
}
|
||||
else
|
||||
{
|
||||
cell = gtk_cell_renderer_text_new ();
|
||||
|
||||
combo = gtk_combo_box_new ();
|
||||
if (cell_combo->model)
|
||||
gtk_combo_box_set_model (GTK_COMBO_BOX (combo), cell_combo->model);
|
||||
if (priv->model)
|
||||
gtk_combo_box_set_model (GTK_COMBO_BOX (combo), priv->model);
|
||||
|
||||
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell, TRUE);
|
||||
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo),
|
||||
cell, "text", cell_combo->text_column,
|
||||
cell, "text", priv->text_column,
|
||||
NULL);
|
||||
|
||||
/* determine the current value */
|
||||
if (cell_combo->model)
|
||||
if (priv->model)
|
||||
{
|
||||
search_data.cell = cell_combo;
|
||||
search_data.found = FALSE;
|
||||
gtk_tree_model_foreach (cell_combo->model, find_text, &search_data);
|
||||
gtk_tree_model_foreach (priv->model, find_text, &search_data);
|
||||
if (search_data.found)
|
||||
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo),
|
||||
&(search_data.iter));
|
||||
@@ -478,10 +500,9 @@ gtk_cell_renderer_combo_start_editing (GtkCellRenderer *cell,
|
||||
g_signal_connect (GTK_CELL_EDITABLE (combo), "changed",
|
||||
G_CALLBACK (gtk_cell_renderer_combo_changed),
|
||||
cell_combo);
|
||||
cell_combo->focus_out_id =
|
||||
g_signal_connect (combo, "focus-out-event",
|
||||
G_CALLBACK (gtk_cell_renderer_combo_focus_out_event),
|
||||
cell_combo);
|
||||
priv->focus_out_id = g_signal_connect (combo, "focus-out-event",
|
||||
G_CALLBACK (gtk_cell_renderer_combo_focus_out_event),
|
||||
cell_combo);
|
||||
|
||||
priv->combo = combo;
|
||||
|
||||
|
||||
@@ -37,18 +37,15 @@ G_BEGIN_DECLS
|
||||
#define GTK_CELL_RENDERER_COMBO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CELL_RENDERER_COMBO, GtkCellRendererTextClass))
|
||||
|
||||
typedef struct _GtkCellRendererCombo GtkCellRendererCombo;
|
||||
typedef struct _GtkCellRendererComboPriv GtkCellRendererComboPriv;
|
||||
typedef struct _GtkCellRendererComboClass GtkCellRendererComboClass;
|
||||
|
||||
struct _GtkCellRendererCombo
|
||||
{
|
||||
GtkCellRendererText parent;
|
||||
|
||||
GtkTreeModel *GSEAL (model);
|
||||
gint GSEAL (text_column);
|
||||
gboolean GSEAL (has_entry);
|
||||
|
||||
/*< private >*/
|
||||
guint GSEAL (focus_out_id);
|
||||
/* <private> */
|
||||
GtkCellRendererComboPriv *priv;
|
||||
};
|
||||
|
||||
struct _GtkCellRendererComboClass
|
||||
|
||||
@@ -67,27 +67,37 @@ enum {
|
||||
};
|
||||
|
||||
|
||||
#define GTK_CELL_RENDERER_PIXBUF_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_CELL_RENDERER_PIXBUF, GtkCellRendererPixbufPrivate))
|
||||
|
||||
typedef struct _GtkCellRendererPixbufPrivate GtkCellRendererPixbufPrivate;
|
||||
struct _GtkCellRendererPixbufPrivate
|
||||
struct _GtkCellRendererPixbufPriv
|
||||
{
|
||||
gchar *stock_id;
|
||||
GtkIconSize stock_size;
|
||||
gchar *stock_detail;
|
||||
gboolean follow_state;
|
||||
gchar *icon_name;
|
||||
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkPixbuf *pixbuf_expander_open;
|
||||
GdkPixbuf *pixbuf_expander_closed;
|
||||
|
||||
GIcon *gicon;
|
||||
|
||||
gboolean follow_state;
|
||||
|
||||
gchar *stock_id;
|
||||
gchar *stock_detail;
|
||||
gchar *icon_name;
|
||||
};
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GtkCellRendererPixbuf, gtk_cell_renderer_pixbuf, GTK_TYPE_CELL_RENDERER)
|
||||
|
||||
|
||||
static void
|
||||
gtk_cell_renderer_pixbuf_init (GtkCellRendererPixbuf *cellpixbuf)
|
||||
{
|
||||
GtkCellRendererPixbufPrivate *priv;
|
||||
GtkCellRendererPixbufPriv *priv;
|
||||
|
||||
cellpixbuf->priv = G_TYPE_INSTANCE_GET_PRIVATE (cellpixbuf,
|
||||
GTK_TYPE_CELL_RENDERER_PIXBUF,
|
||||
GtkCellRendererPixbufPriv);
|
||||
priv = cellpixbuf->priv;
|
||||
|
||||
priv = GTK_CELL_RENDERER_PIXBUF_GET_PRIVATE (cellpixbuf);
|
||||
priv->stock_size = GTK_ICON_SIZE_MENU;
|
||||
}
|
||||
|
||||
@@ -209,23 +219,21 @@ gtk_cell_renderer_pixbuf_class_init (GtkCellRendererPixbufClass *class)
|
||||
|
||||
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (GtkCellRendererPixbufPrivate));
|
||||
g_type_class_add_private (object_class, sizeof (GtkCellRendererPixbufPriv));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_cell_renderer_pixbuf_finalize (GObject *object)
|
||||
{
|
||||
GtkCellRendererPixbuf *cellpixbuf = GTK_CELL_RENDERER_PIXBUF (object);
|
||||
GtkCellRendererPixbufPrivate *priv;
|
||||
GtkCellRendererPixbufPriv *priv = cellpixbuf->priv;
|
||||
|
||||
priv = GTK_CELL_RENDERER_PIXBUF_GET_PRIVATE (object);
|
||||
|
||||
if (cellpixbuf->pixbuf)
|
||||
g_object_unref (cellpixbuf->pixbuf);
|
||||
if (cellpixbuf->pixbuf_expander_open)
|
||||
g_object_unref (cellpixbuf->pixbuf_expander_open);
|
||||
if (cellpixbuf->pixbuf_expander_closed)
|
||||
g_object_unref (cellpixbuf->pixbuf_expander_closed);
|
||||
if (priv->pixbuf)
|
||||
g_object_unref (priv->pixbuf);
|
||||
if (priv->pixbuf_expander_open)
|
||||
g_object_unref (priv->pixbuf_expander_open);
|
||||
if (priv->pixbuf_expander_closed)
|
||||
g_object_unref (priv->pixbuf_expander_closed);
|
||||
|
||||
g_free (priv->stock_id);
|
||||
g_free (priv->stock_detail);
|
||||
@@ -244,20 +252,18 @@ gtk_cell_renderer_pixbuf_get_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkCellRendererPixbuf *cellpixbuf = GTK_CELL_RENDERER_PIXBUF (object);
|
||||
GtkCellRendererPixbufPrivate *priv;
|
||||
GtkCellRendererPixbufPriv *priv = cellpixbuf->priv;
|
||||
|
||||
priv = GTK_CELL_RENDERER_PIXBUF_GET_PRIVATE (object);
|
||||
|
||||
switch (param_id)
|
||||
{
|
||||
case PROP_PIXBUF:
|
||||
g_value_set_object (value, cellpixbuf->pixbuf);
|
||||
g_value_set_object (value, priv->pixbuf);
|
||||
break;
|
||||
case PROP_PIXBUF_EXPANDER_OPEN:
|
||||
g_value_set_object (value, cellpixbuf->pixbuf_expander_open);
|
||||
g_value_set_object (value, priv->pixbuf_expander_open);
|
||||
break;
|
||||
case PROP_PIXBUF_EXPANDER_CLOSED:
|
||||
g_value_set_object (value, cellpixbuf->pixbuf_expander_closed);
|
||||
g_value_set_object (value, priv->pixbuf_expander_closed);
|
||||
break;
|
||||
case PROP_STOCK_ID:
|
||||
g_value_set_string (value, priv->stock_id);
|
||||
@@ -290,17 +296,15 @@ gtk_cell_renderer_pixbuf_set_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkCellRendererPixbuf *cellpixbuf = GTK_CELL_RENDERER_PIXBUF (object);
|
||||
GtkCellRendererPixbufPrivate *priv;
|
||||
GtkCellRendererPixbufPriv *priv = cellpixbuf->priv;
|
||||
|
||||
priv = GTK_CELL_RENDERER_PIXBUF_GET_PRIVATE (object);
|
||||
|
||||
switch (param_id)
|
||||
{
|
||||
case PROP_PIXBUF:
|
||||
if (cellpixbuf->pixbuf)
|
||||
g_object_unref (cellpixbuf->pixbuf);
|
||||
cellpixbuf->pixbuf = (GdkPixbuf*) g_value_dup_object (value);
|
||||
if (cellpixbuf->pixbuf)
|
||||
if (priv->pixbuf)
|
||||
g_object_unref (priv->pixbuf);
|
||||
priv->pixbuf = (GdkPixbuf*) g_value_dup_object (value);
|
||||
if (priv->pixbuf)
|
||||
{
|
||||
if (priv->stock_id)
|
||||
{
|
||||
@@ -323,22 +327,22 @@ gtk_cell_renderer_pixbuf_set_property (GObject *object,
|
||||
}
|
||||
break;
|
||||
case PROP_PIXBUF_EXPANDER_OPEN:
|
||||
if (cellpixbuf->pixbuf_expander_open)
|
||||
g_object_unref (cellpixbuf->pixbuf_expander_open);
|
||||
cellpixbuf->pixbuf_expander_open = (GdkPixbuf*) g_value_dup_object (value);
|
||||
if (priv->pixbuf_expander_open)
|
||||
g_object_unref (priv->pixbuf_expander_open);
|
||||
priv->pixbuf_expander_open = (GdkPixbuf*) g_value_dup_object (value);
|
||||
break;
|
||||
case PROP_PIXBUF_EXPANDER_CLOSED:
|
||||
if (cellpixbuf->pixbuf_expander_closed)
|
||||
g_object_unref (cellpixbuf->pixbuf_expander_closed);
|
||||
cellpixbuf->pixbuf_expander_closed = (GdkPixbuf*) g_value_dup_object (value);
|
||||
if (priv->pixbuf_expander_closed)
|
||||
g_object_unref (priv->pixbuf_expander_closed);
|
||||
priv->pixbuf_expander_closed = (GdkPixbuf*) g_value_dup_object (value);
|
||||
break;
|
||||
case PROP_STOCK_ID:
|
||||
if (priv->stock_id)
|
||||
{
|
||||
if (cellpixbuf->pixbuf)
|
||||
if (priv->pixbuf)
|
||||
{
|
||||
g_object_unref (cellpixbuf->pixbuf);
|
||||
cellpixbuf->pixbuf = NULL;
|
||||
g_object_unref (priv->pixbuf);
|
||||
priv->pixbuf = NULL;
|
||||
g_object_notify (object, "pixbuf");
|
||||
}
|
||||
g_free (priv->stock_id);
|
||||
@@ -346,10 +350,10 @@ gtk_cell_renderer_pixbuf_set_property (GObject *object,
|
||||
priv->stock_id = g_value_dup_string (value);
|
||||
if (priv->stock_id)
|
||||
{
|
||||
if (cellpixbuf->pixbuf)
|
||||
if (priv->pixbuf)
|
||||
{
|
||||
g_object_unref (cellpixbuf->pixbuf);
|
||||
cellpixbuf->pixbuf = NULL;
|
||||
g_object_unref (priv->pixbuf);
|
||||
priv->pixbuf = NULL;
|
||||
g_object_notify (object, "pixbuf");
|
||||
}
|
||||
if (priv->icon_name)
|
||||
@@ -375,24 +379,24 @@ gtk_cell_renderer_pixbuf_set_property (GObject *object,
|
||||
break;
|
||||
case PROP_ICON_NAME:
|
||||
if (priv->icon_name)
|
||||
{
|
||||
if (cellpixbuf->pixbuf)
|
||||
{
|
||||
g_object_unref (cellpixbuf->pixbuf);
|
||||
cellpixbuf->pixbuf = NULL;
|
||||
{
|
||||
if (priv->pixbuf)
|
||||
{
|
||||
g_object_unref (priv->pixbuf);
|
||||
priv->pixbuf = NULL;
|
||||
g_object_notify (object, "pixbuf");
|
||||
}
|
||||
g_free (priv->icon_name);
|
||||
}
|
||||
}
|
||||
g_free (priv->icon_name);
|
||||
}
|
||||
priv->icon_name = g_value_dup_string (value);
|
||||
if (priv->icon_name)
|
||||
{
|
||||
if (cellpixbuf->pixbuf)
|
||||
{
|
||||
g_object_unref (cellpixbuf->pixbuf);
|
||||
cellpixbuf->pixbuf = NULL;
|
||||
if (priv->pixbuf)
|
||||
{
|
||||
g_object_unref (priv->pixbuf);
|
||||
priv->pixbuf = NULL;
|
||||
g_object_notify (object, "pixbuf");
|
||||
}
|
||||
}
|
||||
if (priv->stock_id)
|
||||
{
|
||||
g_free (priv->stock_id);
|
||||
@@ -412,24 +416,24 @@ gtk_cell_renderer_pixbuf_set_property (GObject *object,
|
||||
break;
|
||||
case PROP_GICON:
|
||||
if (priv->gicon)
|
||||
{
|
||||
if (cellpixbuf->pixbuf)
|
||||
{
|
||||
g_object_unref (cellpixbuf->pixbuf);
|
||||
cellpixbuf->pixbuf = NULL;
|
||||
{
|
||||
if (priv->pixbuf)
|
||||
{
|
||||
g_object_unref (priv->pixbuf);
|
||||
priv->pixbuf = NULL;
|
||||
g_object_notify (object, "pixbuf");
|
||||
}
|
||||
g_object_unref (priv->gicon);
|
||||
}
|
||||
}
|
||||
g_object_unref (priv->gicon);
|
||||
}
|
||||
priv->gicon = (GIcon *) g_value_dup_object (value);
|
||||
if (priv->gicon)
|
||||
{
|
||||
if (cellpixbuf->pixbuf)
|
||||
{
|
||||
g_object_unref (cellpixbuf->pixbuf);
|
||||
cellpixbuf->pixbuf = NULL;
|
||||
if (priv->pixbuf)
|
||||
{
|
||||
g_object_unref (priv->pixbuf);
|
||||
priv->pixbuf = NULL;
|
||||
g_object_notify (object, "pixbuf");
|
||||
}
|
||||
}
|
||||
if (priv->stock_id)
|
||||
{
|
||||
g_free (priv->stock_id);
|
||||
@@ -473,14 +477,12 @@ static void
|
||||
gtk_cell_renderer_pixbuf_create_stock_pixbuf (GtkCellRendererPixbuf *cellpixbuf,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
GtkCellRendererPixbufPrivate *priv;
|
||||
GtkCellRendererPixbufPriv *priv = cellpixbuf->priv;
|
||||
|
||||
priv = GTK_CELL_RENDERER_PIXBUF_GET_PRIVATE (cellpixbuf);
|
||||
if (priv->pixbuf)
|
||||
g_object_unref (priv->pixbuf);
|
||||
|
||||
if (cellpixbuf->pixbuf)
|
||||
g_object_unref (cellpixbuf->pixbuf);
|
||||
|
||||
cellpixbuf->pixbuf = gtk_widget_render_icon (widget,
|
||||
priv->pixbuf = gtk_widget_render_icon (widget,
|
||||
priv->stock_id,
|
||||
priv->stock_size,
|
||||
priv->stock_detail);
|
||||
@@ -492,19 +494,17 @@ static void
|
||||
gtk_cell_renderer_pixbuf_create_themed_pixbuf (GtkCellRendererPixbuf *cellpixbuf,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
GtkCellRendererPixbufPrivate *priv;
|
||||
GtkCellRendererPixbufPriv *priv = cellpixbuf->priv;
|
||||
GdkScreen *screen;
|
||||
GtkIconTheme *icon_theme;
|
||||
GtkSettings *settings;
|
||||
gint width, height;
|
||||
GtkIconInfo *info;
|
||||
|
||||
priv = GTK_CELL_RENDERER_PIXBUF_GET_PRIVATE (cellpixbuf);
|
||||
|
||||
if (cellpixbuf->pixbuf)
|
||||
if (priv->pixbuf)
|
||||
{
|
||||
g_object_unref (cellpixbuf->pixbuf);
|
||||
cellpixbuf->pixbuf = NULL;
|
||||
g_object_unref (priv->pixbuf);
|
||||
priv->pixbuf = NULL;
|
||||
}
|
||||
|
||||
screen = gtk_widget_get_screen (GTK_WIDGET (widget));
|
||||
@@ -537,12 +537,11 @@ gtk_cell_renderer_pixbuf_create_themed_pixbuf (GtkCellRendererPixbuf *cellpixbuf
|
||||
GtkStyle *style;
|
||||
|
||||
style = gtk_widget_get_style (GTK_WIDGET (widget));
|
||||
cellpixbuf->pixbuf =
|
||||
gtk_icon_info_load_symbolic_for_style (info,
|
||||
style,
|
||||
GTK_STATE_NORMAL,
|
||||
NULL,
|
||||
NULL);
|
||||
priv->pixbuf = gtk_icon_info_load_symbolic_for_style (info,
|
||||
style,
|
||||
GTK_STATE_NORMAL,
|
||||
NULL,
|
||||
NULL);
|
||||
gtk_icon_info_free (info);
|
||||
}
|
||||
|
||||
@@ -554,7 +553,7 @@ create_symbolic_pixbuf (GtkCellRendererPixbuf *cellpixbuf,
|
||||
GtkWidget *widget,
|
||||
GtkStateType state)
|
||||
{
|
||||
GtkCellRendererPixbufPrivate *priv;
|
||||
GtkCellRendererPixbufPriv *priv = cellpixbuf->priv;
|
||||
GdkScreen *screen;
|
||||
GtkIconTheme *icon_theme;
|
||||
GtkSettings *settings;
|
||||
@@ -562,8 +561,6 @@ create_symbolic_pixbuf (GtkCellRendererPixbuf *cellpixbuf,
|
||||
GtkIconInfo *info;
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
priv = GTK_CELL_RENDERER_PIXBUF_GET_PRIVATE (cellpixbuf);
|
||||
|
||||
/* Not a named symbolic icon? */
|
||||
if (priv->icon_name) {
|
||||
if (!g_str_has_suffix (priv->icon_name, "-symbolic"))
|
||||
@@ -677,15 +674,14 @@ gtk_cell_renderer_pixbuf_get_size (GtkCellRenderer *cell,
|
||||
gint *height)
|
||||
{
|
||||
GtkCellRendererPixbuf *cellpixbuf = (GtkCellRendererPixbuf *) cell;
|
||||
GtkCellRendererPixbufPrivate *priv;
|
||||
GtkCellRendererPixbufPriv *priv = cellpixbuf->priv;
|
||||
gint pixbuf_width = 0;
|
||||
gint pixbuf_height = 0;
|
||||
gint calc_width;
|
||||
gint calc_height;
|
||||
gint xpad, ypad;
|
||||
|
||||
priv = GTK_CELL_RENDERER_PIXBUF_GET_PRIVATE (cell);
|
||||
|
||||
if (!cellpixbuf->pixbuf)
|
||||
if (!priv->pixbuf)
|
||||
{
|
||||
if (priv->stock_id)
|
||||
gtk_cell_renderer_pixbuf_create_stock_pixbuf (cellpixbuf, widget);
|
||||
@@ -693,37 +689,41 @@ gtk_cell_renderer_pixbuf_get_size (GtkCellRenderer *cell,
|
||||
gtk_cell_renderer_pixbuf_create_themed_pixbuf (cellpixbuf, widget);
|
||||
}
|
||||
|
||||
if (cellpixbuf->pixbuf)
|
||||
if (priv->pixbuf)
|
||||
{
|
||||
pixbuf_width = gdk_pixbuf_get_width (cellpixbuf->pixbuf);
|
||||
pixbuf_height = gdk_pixbuf_get_height (cellpixbuf->pixbuf);
|
||||
pixbuf_width = gdk_pixbuf_get_width (priv->pixbuf);
|
||||
pixbuf_height = gdk_pixbuf_get_height (priv->pixbuf);
|
||||
}
|
||||
if (cellpixbuf->pixbuf_expander_open)
|
||||
if (priv->pixbuf_expander_open)
|
||||
{
|
||||
pixbuf_width = MAX (pixbuf_width, gdk_pixbuf_get_width (cellpixbuf->pixbuf_expander_open));
|
||||
pixbuf_height = MAX (pixbuf_height, gdk_pixbuf_get_height (cellpixbuf->pixbuf_expander_open));
|
||||
pixbuf_width = MAX (pixbuf_width, gdk_pixbuf_get_width (priv->pixbuf_expander_open));
|
||||
pixbuf_height = MAX (pixbuf_height, gdk_pixbuf_get_height (priv->pixbuf_expander_open));
|
||||
}
|
||||
if (cellpixbuf->pixbuf_expander_closed)
|
||||
if (priv->pixbuf_expander_closed)
|
||||
{
|
||||
pixbuf_width = MAX (pixbuf_width, gdk_pixbuf_get_width (cellpixbuf->pixbuf_expander_closed));
|
||||
pixbuf_height = MAX (pixbuf_height, gdk_pixbuf_get_height (cellpixbuf->pixbuf_expander_closed));
|
||||
pixbuf_width = MAX (pixbuf_width, gdk_pixbuf_get_width (priv->pixbuf_expander_closed));
|
||||
pixbuf_height = MAX (pixbuf_height, gdk_pixbuf_get_height (priv->pixbuf_expander_closed));
|
||||
}
|
||||
|
||||
calc_width = (gint) cell->xpad * 2 + pixbuf_width;
|
||||
calc_height = (gint) cell->ypad * 2 + pixbuf_height;
|
||||
|
||||
gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
|
||||
calc_width = (gint) xpad * 2 + pixbuf_width;
|
||||
calc_height = (gint) ypad * 2 + pixbuf_height;
|
||||
|
||||
if (cell_area && pixbuf_width > 0 && pixbuf_height > 0)
|
||||
{
|
||||
gfloat xalign, yalign;
|
||||
|
||||
gtk_cell_renderer_get_alignment (cell, &xalign, &yalign);
|
||||
if (x_offset)
|
||||
{
|
||||
*x_offset = (((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ?
|
||||
(1.0 - cell->xalign) : cell->xalign) *
|
||||
(1.0 - xalign) : xalign) *
|
||||
(cell_area->width - calc_width));
|
||||
*x_offset = MAX (*x_offset, 0);
|
||||
}
|
||||
if (y_offset)
|
||||
{
|
||||
*y_offset = (cell->yalign *
|
||||
*y_offset = (yalign *
|
||||
(cell_area->height - calc_height));
|
||||
*y_offset = MAX (*y_offset, 0);
|
||||
}
|
||||
@@ -752,7 +752,7 @@ gtk_cell_renderer_pixbuf_render (GtkCellRenderer *cell,
|
||||
|
||||
{
|
||||
GtkCellRendererPixbuf *cellpixbuf = (GtkCellRendererPixbuf *) cell;
|
||||
GtkCellRendererPixbufPrivate *priv;
|
||||
GtkCellRendererPixbufPriv *priv = cellpixbuf->priv;
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkPixbuf *invisible = NULL;
|
||||
GdkPixbuf *colorized = NULL;
|
||||
@@ -760,8 +760,8 @@ gtk_cell_renderer_pixbuf_render (GtkCellRenderer *cell,
|
||||
GdkRectangle pix_rect;
|
||||
GdkRectangle draw_rect;
|
||||
cairo_t *cr;
|
||||
|
||||
priv = GTK_CELL_RENDERER_PIXBUF_GET_PRIVATE (cell);
|
||||
gboolean is_expander;
|
||||
gint xpad, ypad;
|
||||
|
||||
gtk_cell_renderer_pixbuf_get_size (cell, widget, cell_area,
|
||||
&pix_rect.x,
|
||||
@@ -769,31 +769,38 @@ gtk_cell_renderer_pixbuf_render (GtkCellRenderer *cell,
|
||||
&pix_rect.width,
|
||||
&pix_rect.height);
|
||||
|
||||
pix_rect.x += cell_area->x + cell->xpad;
|
||||
pix_rect.y += cell_area->y + cell->ypad;
|
||||
pix_rect.width -= cell->xpad * 2;
|
||||
pix_rect.height -= cell->ypad * 2;
|
||||
gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
|
||||
pix_rect.x += cell_area->x + xpad;
|
||||
pix_rect.y += cell_area->y + ypad;
|
||||
pix_rect.width -= xpad * 2;
|
||||
pix_rect.height -= ypad * 2;
|
||||
|
||||
if (!gdk_rectangle_intersect (cell_area, &pix_rect, &draw_rect) ||
|
||||
!gdk_rectangle_intersect (expose_area, &draw_rect, &draw_rect))
|
||||
return;
|
||||
|
||||
pixbuf = cellpixbuf->pixbuf;
|
||||
pixbuf = priv->pixbuf;
|
||||
|
||||
if (cell->is_expander)
|
||||
g_object_get (cell, "is-expander", &is_expander, NULL);
|
||||
if (is_expander)
|
||||
{
|
||||
if (cell->is_expanded &&
|
||||
cellpixbuf->pixbuf_expander_open != NULL)
|
||||
pixbuf = cellpixbuf->pixbuf_expander_open;
|
||||
else if (!cell->is_expanded &&
|
||||
cellpixbuf->pixbuf_expander_closed != NULL)
|
||||
pixbuf = cellpixbuf->pixbuf_expander_closed;
|
||||
gboolean is_expanded;
|
||||
|
||||
g_object_get (cell, "is-expanded", &is_expanded, NULL);
|
||||
|
||||
if (is_expanded &&
|
||||
priv->pixbuf_expander_open != NULL)
|
||||
pixbuf = priv->pixbuf_expander_open;
|
||||
else if (!is_expanded &&
|
||||
priv->pixbuf_expander_closed != NULL)
|
||||
pixbuf = priv->pixbuf_expander_closed;
|
||||
}
|
||||
|
||||
if (!pixbuf)
|
||||
return;
|
||||
|
||||
if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE || !cell->sensitive)
|
||||
if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE ||
|
||||
!gtk_cell_renderer_get_sensitive (cell))
|
||||
{
|
||||
GtkIconSource *source;
|
||||
|
||||
|
||||
@@ -37,7 +37,8 @@ G_BEGIN_DECLS
|
||||
#define GTK_IS_CELL_RENDERER_PIXBUF_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CELL_RENDERER_PIXBUF))
|
||||
#define GTK_CELL_RENDERER_PIXBUF_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CELL_RENDERER_PIXBUF, GtkCellRendererPixbufClass))
|
||||
|
||||
typedef struct _GtkCellRendererPixbuf GtkCellRendererPixbuf;
|
||||
typedef struct _GtkCellRendererPixbuf GtkCellRendererPixbuf;
|
||||
typedef struct _GtkCellRendererPixbufPriv GtkCellRendererPixbufPriv;
|
||||
typedef struct _GtkCellRendererPixbufClass GtkCellRendererPixbufClass;
|
||||
|
||||
struct _GtkCellRendererPixbuf
|
||||
@@ -45,9 +46,7 @@ struct _GtkCellRendererPixbuf
|
||||
GtkCellRenderer parent;
|
||||
|
||||
/*< private >*/
|
||||
GdkPixbuf *GSEAL (pixbuf);
|
||||
GdkPixbuf *GSEAL (pixbuf_expander_open);
|
||||
GdkPixbuf *GSEAL (pixbuf_expander_closed);
|
||||
GtkCellRendererPixbufPriv *priv;
|
||||
};
|
||||
|
||||
struct _GtkCellRendererPixbufClass
|
||||
|
||||
@@ -33,9 +33,6 @@
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkintl.h"
|
||||
|
||||
#define GTK_CELL_RENDERER_PROGRESS_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), \
|
||||
GTK_TYPE_CELL_RENDERER_PROGRESS, \
|
||||
GtkCellRendererProgressPrivate))
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -231,7 +228,12 @@ gtk_cell_renderer_progress_class_init (GtkCellRendererProgressClass *klass)
|
||||
static void
|
||||
gtk_cell_renderer_progress_init (GtkCellRendererProgress *cellprogress)
|
||||
{
|
||||
GtkCellRendererProgressPrivate *priv = GTK_CELL_RENDERER_PROGRESS_GET_PRIVATE (cellprogress);
|
||||
GtkCellRendererProgressPrivate *priv;
|
||||
|
||||
cellprogress->priv = G_TYPE_INSTANCE_GET_PRIVATE (cellprogress,
|
||||
GTK_TYPE_CELL_RENDERER_PROGRESS,
|
||||
GtkCellRendererProgressPrivate);
|
||||
priv = cellprogress->priv;
|
||||
|
||||
priv->value = 0;
|
||||
priv->text = NULL;
|
||||
@@ -245,8 +247,6 @@ gtk_cell_renderer_progress_init (GtkCellRendererProgress *cellprogress)
|
||||
priv->text_yalign = 0.5;
|
||||
|
||||
priv->orientation = GTK_PROGRESS_LEFT_TO_RIGHT;
|
||||
|
||||
cellprogress->priv = priv;
|
||||
}
|
||||
|
||||
|
||||
@@ -415,15 +415,18 @@ compute_dimensions (GtkCellRenderer *cell,
|
||||
{
|
||||
PangoRectangle logical_rect;
|
||||
PangoLayout *layout;
|
||||
gint xpad, ypad;
|
||||
|
||||
layout = gtk_widget_create_pango_layout (widget, text);
|
||||
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
|
||||
|
||||
gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
|
||||
|
||||
if (width)
|
||||
*width = logical_rect.width + cell->xpad * 2;
|
||||
*width = logical_rect.width + xpad * 2;
|
||||
|
||||
if (height)
|
||||
*height = logical_rect.height + cell->ypad * 2;
|
||||
*height = logical_rect.height + ypad * 2;
|
||||
|
||||
g_object_unref (layout);
|
||||
}
|
||||
@@ -534,15 +537,17 @@ gtk_cell_renderer_progress_render (GtkCellRenderer *cell,
|
||||
PangoLayout *layout;
|
||||
PangoRectangle logical_rect;
|
||||
gint x, y, w, h, x_pos, y_pos, bar_position, bar_size, start, full_size;
|
||||
gint xpad, ypad;
|
||||
GdkRectangle clip;
|
||||
gboolean is_rtl;
|
||||
|
||||
is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
|
||||
|
||||
x = cell_area->x + cell->xpad;
|
||||
y = cell_area->y + cell->ypad;
|
||||
w = cell_area->width - cell->xpad * 2;
|
||||
h = cell_area->height - cell->ypad * 2;
|
||||
|
||||
gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
|
||||
x = cell_area->x + xpad;
|
||||
y = cell_area->y + ypad;
|
||||
w = cell_area->width - xpad * 2;
|
||||
h = cell_area->height - ypad * 2;
|
||||
|
||||
/* FIXME: GtkProgressBar draws the box with "trough" detail,
|
||||
* but some engines don't paint anything with that detail for
|
||||
|
||||
@@ -52,7 +52,7 @@ struct _GtkCellRendererProgress
|
||||
GtkCellRenderer parent_instance;
|
||||
|
||||
/*< private >*/
|
||||
GtkCellRendererProgressPrivate *GSEAL (priv);
|
||||
GtkCellRendererProgressPrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkCellRendererProgressClass
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include "gtkspinbutton.h"
|
||||
#include "gtkcellrendererspin.h"
|
||||
|
||||
#define GTK_CELL_RENDERER_SPIN_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_CELL_RENDERER_SPIN, GtkCellRendererSpinPrivate))
|
||||
|
||||
struct _GtkCellRendererSpinPrivate
|
||||
{
|
||||
@@ -132,7 +131,10 @@ gtk_cell_renderer_spin_init (GtkCellRendererSpin *self)
|
||||
{
|
||||
GtkCellRendererSpinPrivate *priv;
|
||||
|
||||
priv = GTK_CELL_RENDERER_SPIN_GET_PRIVATE (self);
|
||||
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
|
||||
GTK_TYPE_CELL_RENDERER_SPIN,
|
||||
GtkCellRendererSpinPrivate);
|
||||
priv = self->priv;
|
||||
|
||||
priv->adjustment = NULL;
|
||||
priv->climb_rate = 0.0;
|
||||
@@ -144,7 +146,7 @@ gtk_cell_renderer_spin_finalize (GObject *object)
|
||||
{
|
||||
GtkCellRendererSpinPrivate *priv;
|
||||
|
||||
priv = GTK_CELL_RENDERER_SPIN_GET_PRIVATE (object);
|
||||
priv = GTK_CELL_RENDERER_SPIN (object)->priv;
|
||||
|
||||
if (priv && priv->adjustment)
|
||||
g_object_unref (priv->adjustment);
|
||||
@@ -162,7 +164,7 @@ gtk_cell_renderer_spin_get_property (GObject *object,
|
||||
GtkCellRendererSpinPrivate *priv;
|
||||
|
||||
renderer = GTK_CELL_RENDERER_SPIN (object);
|
||||
priv = GTK_CELL_RENDERER_SPIN_GET_PRIVATE (renderer);
|
||||
priv = renderer->priv;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
@@ -192,7 +194,7 @@ gtk_cell_renderer_spin_set_property (GObject *object,
|
||||
GObject *obj;
|
||||
|
||||
renderer = GTK_CELL_RENDERER_SPIN (object);
|
||||
priv = GTK_CELL_RENDERER_SPIN_GET_PRIVATE (renderer);
|
||||
priv = renderer->priv;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
@@ -299,11 +301,14 @@ gtk_cell_renderer_spin_start_editing (GtkCellRenderer *cell,
|
||||
GtkCellRendererSpinPrivate *priv;
|
||||
GtkCellRendererText *cell_text;
|
||||
GtkWidget *spin;
|
||||
gboolean editable;
|
||||
gchar *text;
|
||||
|
||||
cell_text = GTK_CELL_RENDERER_TEXT (cell);
|
||||
priv = GTK_CELL_RENDERER_SPIN_GET_PRIVATE (cell);
|
||||
priv = GTK_CELL_RENDERER_SPIN (cell)->priv;
|
||||
|
||||
if (!cell_text->editable)
|
||||
g_object_get (cell_text, "editable", &editable, NULL);
|
||||
if (!editable)
|
||||
return NULL;
|
||||
|
||||
if (!priv->adjustment)
|
||||
@@ -316,9 +321,11 @@ gtk_cell_renderer_spin_start_editing (GtkCellRenderer *cell,
|
||||
G_CALLBACK (gtk_cell_renderer_spin_button_press_event),
|
||||
NULL);
|
||||
|
||||
if (cell_text->text)
|
||||
g_object_get (cell_text, "text", &text, NULL);
|
||||
if (text)
|
||||
gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin),
|
||||
g_ascii_strtod (cell_text->text, NULL));
|
||||
g_ascii_strtod (text, NULL));
|
||||
g_free (text);
|
||||
|
||||
g_object_set_data_full (G_OBJECT (spin), GTK_CELL_RENDERER_SPIN_PATH,
|
||||
g_strdup (path), g_free);
|
||||
|
||||
@@ -42,6 +42,9 @@ typedef struct _GtkCellRendererSpinPrivate GtkCellRendererSpinPrivate;
|
||||
struct _GtkCellRendererSpin
|
||||
{
|
||||
GtkCellRendererText parent;
|
||||
|
||||
/* <private> */
|
||||
GtkCellRendererSpinPrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkCellRendererSpinClass
|
||||
|
||||
@@ -69,10 +69,6 @@ struct _GtkCellRendererSpinnerPrivate
|
||||
gint size;
|
||||
};
|
||||
|
||||
#define GTK_CELL_RENDERER_SPINNER_GET_PRIVATE(object) \
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE ((object), \
|
||||
GTK_TYPE_CELL_RENDERER_SPINNER, \
|
||||
GtkCellRendererSpinnerPrivate))
|
||||
|
||||
static void gtk_cell_renderer_spinner_get_property (GObject *object,
|
||||
guint param_id,
|
||||
@@ -166,7 +162,10 @@ gtk_cell_renderer_spinner_class_init (GtkCellRendererSpinnerClass *klass)
|
||||
static void
|
||||
gtk_cell_renderer_spinner_init (GtkCellRendererSpinner *cell)
|
||||
{
|
||||
cell->priv = GTK_CELL_RENDERER_SPINNER_GET_PRIVATE (cell);
|
||||
cell->priv = G_TYPE_INSTANCE_GET_PRIVATE (cell,
|
||||
GTK_TYPE_CELL_RENDERER_SPINNER,
|
||||
GtkCellRendererSpinnerPrivate);
|
||||
|
||||
cell->priv->pulse = 0;
|
||||
cell->priv->old_icon_size = GTK_ICON_SIZE_INVALID;
|
||||
cell->priv->icon_size = GTK_ICON_SIZE_MENU;
|
||||
@@ -359,7 +358,8 @@ gtk_cell_renderer_spinner_render (GtkCellRenderer *cellr,
|
||||
}
|
||||
|
||||
state = GTK_STATE_NORMAL;
|
||||
if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE || !cellr->sensitive)
|
||||
if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE ||
|
||||
!gtk_cell_renderer_get_sensitive (cellr))
|
||||
{
|
||||
state = GTK_STATE_INSENSITIVE;
|
||||
}
|
||||
|
||||
@@ -45,6 +45,8 @@ typedef struct _GtkCellRendererSpinnerPrivate GtkCellRendererSpinnerPrivate;
|
||||
struct _GtkCellRendererSpinner
|
||||
{
|
||||
GtkCellRenderer parent;
|
||||
|
||||
/* <private> */
|
||||
GtkCellRendererSpinnerPrivate *priv;
|
||||
};
|
||||
|
||||
|
||||
@@ -123,31 +123,50 @@ static guint text_cell_renderer_signals [LAST_SIGNAL];
|
||||
|
||||
#define GTK_CELL_RENDERER_TEXT_PATH "gtk-cell-renderer-text-path"
|
||||
|
||||
#define GTK_CELL_RENDERER_TEXT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_CELL_RENDERER_TEXT, GtkCellRendererTextPrivate))
|
||||
|
||||
typedef struct _GtkCellRendererTextPrivate GtkCellRendererTextPrivate;
|
||||
struct _GtkCellRendererTextPrivate
|
||||
struct _GtkCellRendererTextPriv
|
||||
{
|
||||
guint single_paragraph : 1;
|
||||
guint language_set : 1;
|
||||
guint markup_set : 1;
|
||||
guint ellipsize_set : 1;
|
||||
guint align_set : 1;
|
||||
|
||||
gulong focus_out_id;
|
||||
PangoLanguage *language;
|
||||
PangoEllipsizeMode ellipsize;
|
||||
PangoWrapMode wrap_mode;
|
||||
PangoAlignment align;
|
||||
|
||||
gulong populate_popup_id;
|
||||
gulong entry_menu_popdown_timeout;
|
||||
GtkWidget *entry;
|
||||
|
||||
PangoAlignment align;
|
||||
PangoAttrList *extra_attrs;
|
||||
PangoColor foreground;
|
||||
PangoColor background;
|
||||
PangoEllipsizeMode ellipsize;
|
||||
PangoFontDescription *font;
|
||||
PangoLanguage *language;
|
||||
PangoUnderline underline_style;
|
||||
PangoWrapMode wrap_mode;
|
||||
|
||||
gboolean in_entry_menu;
|
||||
|
||||
|
||||
gchar *text;
|
||||
|
||||
gdouble font_scale;
|
||||
|
||||
gint rise;
|
||||
gint fixed_height_rows;
|
||||
gint width_chars;
|
||||
gint wrap_width;
|
||||
|
||||
GtkWidget *entry;
|
||||
|
||||
guint strikethrough : 1;
|
||||
guint editable : 1;
|
||||
guint scale_set : 1;
|
||||
guint foreground_set : 1;
|
||||
guint background_set : 1;
|
||||
guint underline_set : 1;
|
||||
guint rise_set : 1;
|
||||
guint strikethrough_set : 1;
|
||||
guint editable_set : 1;
|
||||
guint calc_fixed_height : 1;
|
||||
guint single_paragraph : 1;
|
||||
guint language_set : 1;
|
||||
guint markup_set : 1;
|
||||
guint ellipsize_set : 1;
|
||||
guint align_set : 1;
|
||||
|
||||
gulong focus_out_id;
|
||||
gulong populate_popup_id;
|
||||
gulong entry_menu_popdown_timeout;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GtkCellRendererText, gtk_cell_renderer_text, GTK_TYPE_CELL_RENDERER)
|
||||
@@ -155,17 +174,19 @@ G_DEFINE_TYPE (GtkCellRendererText, gtk_cell_renderer_text, GTK_TYPE_CELL_RENDER
|
||||
static void
|
||||
gtk_cell_renderer_text_init (GtkCellRendererText *celltext)
|
||||
{
|
||||
GtkCellRendererTextPrivate *priv;
|
||||
GtkCellRendererTextPriv *priv;
|
||||
GtkCellRenderer *cell = GTK_CELL_RENDERER (celltext);
|
||||
|
||||
priv = GTK_CELL_RENDERER_TEXT_GET_PRIVATE (celltext);
|
||||
celltext->priv = G_TYPE_INSTANCE_GET_PRIVATE (celltext,
|
||||
GTK_TYPE_CELL_RENDERER_TEXT,
|
||||
GtkCellRendererTextPriv);
|
||||
priv = celltext->priv;
|
||||
|
||||
GTK_CELL_RENDERER (celltext)->xalign = 0.0;
|
||||
GTK_CELL_RENDERER (celltext)->yalign = 0.5;
|
||||
GTK_CELL_RENDERER (celltext)->xpad = 2;
|
||||
GTK_CELL_RENDERER (celltext)->ypad = 2;
|
||||
celltext->font_scale = 1.0;
|
||||
celltext->fixed_height_rows = -1;
|
||||
celltext->font = pango_font_description_new ();
|
||||
gtk_cell_renderer_set_alignment (cell, 0.0, 0.5);
|
||||
gtk_cell_renderer_set_padding (cell, 2, 2);
|
||||
priv->font_scale = 1.0;
|
||||
priv->fixed_height_rows = -1;
|
||||
priv->font = pango_font_description_new ();
|
||||
|
||||
priv->width_chars = -1;
|
||||
priv->wrap_width = -1;
|
||||
@@ -584,23 +605,21 @@ gtk_cell_renderer_text_class_init (GtkCellRendererTextClass *class)
|
||||
G_TYPE_STRING,
|
||||
G_TYPE_STRING);
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (GtkCellRendererTextPrivate));
|
||||
g_type_class_add_private (object_class, sizeof (GtkCellRendererTextPriv));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_cell_renderer_text_finalize (GObject *object)
|
||||
{
|
||||
GtkCellRendererText *celltext = GTK_CELL_RENDERER_TEXT (object);
|
||||
GtkCellRendererTextPrivate *priv;
|
||||
GtkCellRendererTextPriv *priv = celltext->priv;
|
||||
|
||||
priv = GTK_CELL_RENDERER_TEXT_GET_PRIVATE (object);
|
||||
pango_font_description_free (priv->font);
|
||||
|
||||
pango_font_description_free (celltext->font);
|
||||
g_free (priv->text);
|
||||
|
||||
g_free (celltext->text);
|
||||
|
||||
if (celltext->extra_attrs)
|
||||
pango_attr_list_unref (celltext->extra_attrs);
|
||||
if (priv->extra_attrs)
|
||||
pango_attr_list_unref (priv->extra_attrs);
|
||||
|
||||
if (priv->language)
|
||||
g_object_unref (priv->language);
|
||||
@@ -637,18 +656,16 @@ gtk_cell_renderer_text_get_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkCellRendererText *celltext = GTK_CELL_RENDERER_TEXT (object);
|
||||
GtkCellRendererTextPrivate *priv;
|
||||
|
||||
priv = GTK_CELL_RENDERER_TEXT_GET_PRIVATE (object);
|
||||
GtkCellRendererTextPriv *priv = celltext->priv;
|
||||
|
||||
switch (param_id)
|
||||
{
|
||||
case PROP_TEXT:
|
||||
g_value_set_string (value, celltext->text);
|
||||
g_value_set_string (value, priv->text);
|
||||
break;
|
||||
|
||||
case PROP_ATTRIBUTES:
|
||||
g_value_set_boxed (value, celltext->extra_attrs);
|
||||
g_value_set_boxed (value, priv->extra_attrs);
|
||||
break;
|
||||
|
||||
case PROP_SINGLE_PARAGRAPH_MODE:
|
||||
@@ -659,9 +676,9 @@ gtk_cell_renderer_text_get_property (GObject *object,
|
||||
{
|
||||
GdkColor color;
|
||||
|
||||
color.red = celltext->background.red;
|
||||
color.green = celltext->background.green;
|
||||
color.blue = celltext->background.blue;
|
||||
color.red = priv->background.red;
|
||||
color.green = priv->background.green;
|
||||
color.blue = priv->background.blue;
|
||||
|
||||
g_value_set_boxed (value, &color);
|
||||
}
|
||||
@@ -671,68 +688,68 @@ gtk_cell_renderer_text_get_property (GObject *object,
|
||||
{
|
||||
GdkColor color;
|
||||
|
||||
color.red = celltext->foreground.red;
|
||||
color.green = celltext->foreground.green;
|
||||
color.blue = celltext->foreground.blue;
|
||||
color.red = priv->foreground.red;
|
||||
color.green = priv->foreground.green;
|
||||
color.blue = priv->foreground.blue;
|
||||
|
||||
g_value_set_boxed (value, &color);
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_FONT:
|
||||
g_value_take_string (value, pango_font_description_to_string (celltext->font));
|
||||
g_value_take_string (value, pango_font_description_to_string (priv->font));
|
||||
break;
|
||||
|
||||
case PROP_FONT_DESC:
|
||||
g_value_set_boxed (value, celltext->font);
|
||||
g_value_set_boxed (value, priv->font);
|
||||
break;
|
||||
|
||||
case PROP_FAMILY:
|
||||
g_value_set_string (value, pango_font_description_get_family (celltext->font));
|
||||
g_value_set_string (value, pango_font_description_get_family (priv->font));
|
||||
break;
|
||||
|
||||
case PROP_STYLE:
|
||||
g_value_set_enum (value, pango_font_description_get_style (celltext->font));
|
||||
g_value_set_enum (value, pango_font_description_get_style (priv->font));
|
||||
break;
|
||||
|
||||
case PROP_VARIANT:
|
||||
g_value_set_enum (value, pango_font_description_get_variant (celltext->font));
|
||||
g_value_set_enum (value, pango_font_description_get_variant (priv->font));
|
||||
break;
|
||||
|
||||
case PROP_WEIGHT:
|
||||
g_value_set_int (value, pango_font_description_get_weight (celltext->font));
|
||||
g_value_set_int (value, pango_font_description_get_weight (priv->font));
|
||||
break;
|
||||
|
||||
case PROP_STRETCH:
|
||||
g_value_set_enum (value, pango_font_description_get_stretch (celltext->font));
|
||||
g_value_set_enum (value, pango_font_description_get_stretch (priv->font));
|
||||
break;
|
||||
|
||||
case PROP_SIZE:
|
||||
g_value_set_int (value, pango_font_description_get_size (celltext->font));
|
||||
g_value_set_int (value, pango_font_description_get_size (priv->font));
|
||||
break;
|
||||
|
||||
case PROP_SIZE_POINTS:
|
||||
g_value_set_double (value, ((double)pango_font_description_get_size (celltext->font)) / (double)PANGO_SCALE);
|
||||
g_value_set_double (value, ((double)pango_font_description_get_size (priv->font)) / (double)PANGO_SCALE);
|
||||
break;
|
||||
|
||||
case PROP_SCALE:
|
||||
g_value_set_double (value, celltext->font_scale);
|
||||
g_value_set_double (value, priv->font_scale);
|
||||
break;
|
||||
|
||||
case PROP_EDITABLE:
|
||||
g_value_set_boolean (value, celltext->editable);
|
||||
g_value_set_boolean (value, priv->editable);
|
||||
break;
|
||||
|
||||
case PROP_STRIKETHROUGH:
|
||||
g_value_set_boolean (value, celltext->strikethrough);
|
||||
g_value_set_boolean (value, priv->strikethrough);
|
||||
break;
|
||||
|
||||
case PROP_UNDERLINE:
|
||||
g_value_set_enum (value, celltext->underline_style);
|
||||
g_value_set_enum (value, priv->underline_style);
|
||||
break;
|
||||
|
||||
case PROP_RISE:
|
||||
g_value_set_int (value, celltext->rise);
|
||||
g_value_set_int (value, priv->rise);
|
||||
break;
|
||||
|
||||
case PROP_LANGUAGE:
|
||||
@@ -756,11 +773,11 @@ gtk_cell_renderer_text_get_property (GObject *object,
|
||||
break;
|
||||
|
||||
case PROP_BACKGROUND_SET:
|
||||
g_value_set_boolean (value, celltext->background_set);
|
||||
g_value_set_boolean (value, priv->background_set);
|
||||
break;
|
||||
|
||||
case PROP_FOREGROUND_SET:
|
||||
g_value_set_boolean (value, celltext->foreground_set);
|
||||
g_value_set_boolean (value, priv->foreground_set);
|
||||
break;
|
||||
|
||||
case PROP_FAMILY_SET:
|
||||
@@ -771,29 +788,29 @@ gtk_cell_renderer_text_get_property (GObject *object,
|
||||
case PROP_SIZE_SET:
|
||||
{
|
||||
PangoFontMask mask = get_property_font_set_mask (param_id);
|
||||
g_value_set_boolean (value, (pango_font_description_get_set_fields (celltext->font) & mask) != 0);
|
||||
g_value_set_boolean (value, (pango_font_description_get_set_fields (priv->font) & mask) != 0);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case PROP_SCALE_SET:
|
||||
g_value_set_boolean (value, celltext->scale_set);
|
||||
g_value_set_boolean (value, priv->scale_set);
|
||||
break;
|
||||
|
||||
case PROP_EDITABLE_SET:
|
||||
g_value_set_boolean (value, celltext->editable_set);
|
||||
g_value_set_boolean (value, priv->editable_set);
|
||||
break;
|
||||
|
||||
case PROP_STRIKETHROUGH_SET:
|
||||
g_value_set_boolean (value, celltext->strikethrough_set);
|
||||
g_value_set_boolean (value, priv->strikethrough_set);
|
||||
break;
|
||||
|
||||
case PROP_UNDERLINE_SET:
|
||||
g_value_set_boolean (value, celltext->underline_set);
|
||||
g_value_set_boolean (value, priv->underline_set);
|
||||
break;
|
||||
|
||||
case PROP_RISE_SET:
|
||||
g_value_set_boolean (value, celltext->rise_set);
|
||||
g_value_set_boolean (value, priv->rise_set);
|
||||
break;
|
||||
|
||||
case PROP_LANGUAGE_SET:
|
||||
@@ -826,23 +843,25 @@ static void
|
||||
set_bg_color (GtkCellRendererText *celltext,
|
||||
GdkColor *color)
|
||||
{
|
||||
GtkCellRendererTextPriv *priv = celltext->priv;
|
||||
|
||||
if (color)
|
||||
{
|
||||
if (!celltext->background_set)
|
||||
if (!priv->background_set)
|
||||
{
|
||||
celltext->background_set = TRUE;
|
||||
priv->background_set = TRUE;
|
||||
g_object_notify (G_OBJECT (celltext), "background-set");
|
||||
}
|
||||
|
||||
celltext->background.red = color->red;
|
||||
celltext->background.green = color->green;
|
||||
celltext->background.blue = color->blue;
|
||||
priv->background.red = color->red;
|
||||
priv->background.green = color->green;
|
||||
priv->background.blue = color->blue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (celltext->background_set)
|
||||
if (priv->background_set)
|
||||
{
|
||||
celltext->background_set = FALSE;
|
||||
priv->background_set = FALSE;
|
||||
g_object_notify (G_OBJECT (celltext), "background-set");
|
||||
}
|
||||
}
|
||||
@@ -853,23 +872,25 @@ static void
|
||||
set_fg_color (GtkCellRendererText *celltext,
|
||||
GdkColor *color)
|
||||
{
|
||||
GtkCellRendererTextPriv *priv = celltext->priv;
|
||||
|
||||
if (color)
|
||||
{
|
||||
if (!celltext->foreground_set)
|
||||
if (!priv->foreground_set)
|
||||
{
|
||||
celltext->foreground_set = TRUE;
|
||||
priv->foreground_set = TRUE;
|
||||
g_object_notify (G_OBJECT (celltext), "foreground-set");
|
||||
}
|
||||
|
||||
celltext->foreground.red = color->red;
|
||||
celltext->foreground.green = color->green;
|
||||
celltext->foreground.blue = color->blue;
|
||||
priv->foreground.red = color->red;
|
||||
priv->foreground.green = color->green;
|
||||
priv->foreground.blue = color->blue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (celltext->foreground_set)
|
||||
if (priv->foreground_set)
|
||||
{
|
||||
celltext->foreground_set = FALSE;
|
||||
priv->foreground_set = FALSE;
|
||||
g_object_notify (G_OBJECT (celltext), "foreground-set");
|
||||
}
|
||||
}
|
||||
@@ -955,6 +976,7 @@ static void
|
||||
set_font_description (GtkCellRendererText *celltext,
|
||||
PangoFontDescription *font_desc)
|
||||
{
|
||||
GtkCellRendererTextPriv *priv = celltext->priv;
|
||||
GObject *object = G_OBJECT (celltext);
|
||||
PangoFontDescription *new_font_desc;
|
||||
PangoFontMask old_mask, new_mask, changed_mask, set_changed_mask;
|
||||
@@ -964,14 +986,14 @@ set_font_description (GtkCellRendererText *celltext,
|
||||
else
|
||||
new_font_desc = pango_font_description_new ();
|
||||
|
||||
old_mask = pango_font_description_get_set_fields (celltext->font);
|
||||
old_mask = pango_font_description_get_set_fields (priv->font);
|
||||
new_mask = pango_font_description_get_set_fields (new_font_desc);
|
||||
|
||||
changed_mask = old_mask | new_mask;
|
||||
set_changed_mask = old_mask ^ new_mask;
|
||||
|
||||
pango_font_description_free (celltext->font);
|
||||
celltext->font = new_font_desc;
|
||||
pango_font_description_free (priv->font);
|
||||
priv->font = new_font_desc;
|
||||
|
||||
g_object_freeze_notify (object);
|
||||
|
||||
@@ -1006,34 +1028,32 @@ gtk_cell_renderer_text_set_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkCellRendererText *celltext = GTK_CELL_RENDERER_TEXT (object);
|
||||
GtkCellRendererTextPrivate *priv;
|
||||
|
||||
priv = GTK_CELL_RENDERER_TEXT_GET_PRIVATE (object);
|
||||
GtkCellRendererTextPriv *priv = celltext->priv;
|
||||
|
||||
switch (param_id)
|
||||
{
|
||||
case PROP_TEXT:
|
||||
g_free (celltext->text);
|
||||
g_free (priv->text);
|
||||
|
||||
if (priv->markup_set)
|
||||
{
|
||||
if (celltext->extra_attrs)
|
||||
pango_attr_list_unref (celltext->extra_attrs);
|
||||
celltext->extra_attrs = NULL;
|
||||
if (priv->extra_attrs)
|
||||
pango_attr_list_unref (priv->extra_attrs);
|
||||
priv->extra_attrs = NULL;
|
||||
priv->markup_set = FALSE;
|
||||
}
|
||||
|
||||
celltext->text = g_value_dup_string (value);
|
||||
priv->text = g_value_dup_string (value);
|
||||
g_object_notify (object, "text");
|
||||
break;
|
||||
|
||||
case PROP_ATTRIBUTES:
|
||||
if (celltext->extra_attrs)
|
||||
pango_attr_list_unref (celltext->extra_attrs);
|
||||
if (priv->extra_attrs)
|
||||
pango_attr_list_unref (priv->extra_attrs);
|
||||
|
||||
celltext->extra_attrs = g_value_get_boxed (value);
|
||||
if (celltext->extra_attrs)
|
||||
pango_attr_list_ref (celltext->extra_attrs);
|
||||
priv->extra_attrs = g_value_get_boxed (value);
|
||||
if (priv->extra_attrs)
|
||||
pango_attr_list_ref (priv->extra_attrs);
|
||||
break;
|
||||
case PROP_MARKUP:
|
||||
{
|
||||
@@ -1057,13 +1077,13 @@ gtk_cell_renderer_text_set_property (GObject *object,
|
||||
return;
|
||||
}
|
||||
|
||||
g_free (celltext->text);
|
||||
g_free (priv->text);
|
||||
|
||||
if (celltext->extra_attrs)
|
||||
pango_attr_list_unref (celltext->extra_attrs);
|
||||
if (priv->extra_attrs)
|
||||
pango_attr_list_unref (priv->extra_attrs);
|
||||
|
||||
celltext->text = text;
|
||||
celltext->extra_attrs = attrs;
|
||||
priv->text = text;
|
||||
priv->extra_attrs = attrs;
|
||||
priv->markup_set = TRUE;
|
||||
}
|
||||
break;
|
||||
@@ -1126,16 +1146,16 @@ gtk_cell_renderer_text_set_property (GObject *object,
|
||||
|
||||
pango_font_description_free (font_desc);
|
||||
|
||||
if (celltext->fixed_height_rows != -1)
|
||||
celltext->calc_fixed_height = TRUE;
|
||||
if (priv->fixed_height_rows != -1)
|
||||
priv->calc_fixed_height = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_FONT_DESC:
|
||||
set_font_description (celltext, g_value_get_boxed (value));
|
||||
|
||||
if (celltext->fixed_height_rows != -1)
|
||||
celltext->calc_fixed_height = TRUE;
|
||||
if (priv->fixed_height_rows != -1)
|
||||
priv->calc_fixed_height = TRUE;
|
||||
break;
|
||||
|
||||
case PROP_FAMILY:
|
||||
@@ -1146,46 +1166,46 @@ gtk_cell_renderer_text_set_property (GObject *object,
|
||||
case PROP_SIZE:
|
||||
case PROP_SIZE_POINTS:
|
||||
{
|
||||
PangoFontMask old_set_mask = pango_font_description_get_set_fields (celltext->font);
|
||||
PangoFontMask old_set_mask = pango_font_description_get_set_fields (priv->font);
|
||||
|
||||
switch (param_id)
|
||||
{
|
||||
case PROP_FAMILY:
|
||||
pango_font_description_set_family (celltext->font,
|
||||
pango_font_description_set_family (priv->font,
|
||||
g_value_get_string (value));
|
||||
break;
|
||||
case PROP_STYLE:
|
||||
pango_font_description_set_style (celltext->font,
|
||||
pango_font_description_set_style (priv->font,
|
||||
g_value_get_enum (value));
|
||||
break;
|
||||
case PROP_VARIANT:
|
||||
pango_font_description_set_variant (celltext->font,
|
||||
pango_font_description_set_variant (priv->font,
|
||||
g_value_get_enum (value));
|
||||
break;
|
||||
case PROP_WEIGHT:
|
||||
pango_font_description_set_weight (celltext->font,
|
||||
pango_font_description_set_weight (priv->font,
|
||||
g_value_get_int (value));
|
||||
break;
|
||||
case PROP_STRETCH:
|
||||
pango_font_description_set_stretch (celltext->font,
|
||||
pango_font_description_set_stretch (priv->font,
|
||||
g_value_get_enum (value));
|
||||
break;
|
||||
case PROP_SIZE:
|
||||
pango_font_description_set_size (celltext->font,
|
||||
pango_font_description_set_size (priv->font,
|
||||
g_value_get_int (value));
|
||||
g_object_notify (object, "size-points");
|
||||
break;
|
||||
case PROP_SIZE_POINTS:
|
||||
pango_font_description_set_size (celltext->font,
|
||||
pango_font_description_set_size (priv->font,
|
||||
g_value_get_double (value) * PANGO_SCALE);
|
||||
g_object_notify (object, "size");
|
||||
break;
|
||||
}
|
||||
|
||||
if (celltext->fixed_height_rows != -1)
|
||||
celltext->calc_fixed_height = TRUE;
|
||||
if (priv->fixed_height_rows != -1)
|
||||
priv->calc_fixed_height = TRUE;
|
||||
|
||||
notify_set_changed (object, old_set_mask & pango_font_description_get_set_fields (celltext->font));
|
||||
notify_set_changed (object, old_set_mask & pango_font_description_get_set_fields (priv->font));
|
||||
g_object_notify (object, "font-desc");
|
||||
g_object_notify (object, "font");
|
||||
|
||||
@@ -1193,42 +1213,42 @@ gtk_cell_renderer_text_set_property (GObject *object,
|
||||
}
|
||||
|
||||
case PROP_SCALE:
|
||||
celltext->font_scale = g_value_get_double (value);
|
||||
celltext->scale_set = TRUE;
|
||||
if (celltext->fixed_height_rows != -1)
|
||||
celltext->calc_fixed_height = TRUE;
|
||||
priv->font_scale = g_value_get_double (value);
|
||||
priv->scale_set = TRUE;
|
||||
if (priv->fixed_height_rows != -1)
|
||||
priv->calc_fixed_height = TRUE;
|
||||
g_object_notify (object, "scale-set");
|
||||
break;
|
||||
|
||||
case PROP_EDITABLE:
|
||||
celltext->editable = g_value_get_boolean (value);
|
||||
celltext->editable_set = TRUE;
|
||||
if (celltext->editable)
|
||||
GTK_CELL_RENDERER (celltext)->mode = GTK_CELL_RENDERER_MODE_EDITABLE;
|
||||
priv->editable = g_value_get_boolean (value);
|
||||
priv->editable_set = TRUE;
|
||||
if (priv->editable)
|
||||
g_object_set (celltext, "mode", GTK_CELL_RENDERER_MODE_EDITABLE, NULL);
|
||||
else
|
||||
GTK_CELL_RENDERER (celltext)->mode = GTK_CELL_RENDERER_MODE_INERT;
|
||||
g_object_set (celltext, "mode", GTK_CELL_RENDERER_MODE_INERT, NULL);
|
||||
g_object_notify (object, "editable-set");
|
||||
break;
|
||||
|
||||
case PROP_STRIKETHROUGH:
|
||||
celltext->strikethrough = g_value_get_boolean (value);
|
||||
celltext->strikethrough_set = TRUE;
|
||||
priv->strikethrough = g_value_get_boolean (value);
|
||||
priv->strikethrough_set = TRUE;
|
||||
g_object_notify (object, "strikethrough-set");
|
||||
break;
|
||||
|
||||
case PROP_UNDERLINE:
|
||||
celltext->underline_style = g_value_get_enum (value);
|
||||
celltext->underline_set = TRUE;
|
||||
priv->underline_style = g_value_get_enum (value);
|
||||
priv->underline_set = TRUE;
|
||||
g_object_notify (object, "underline-set");
|
||||
|
||||
break;
|
||||
|
||||
case PROP_RISE:
|
||||
celltext->rise = g_value_get_int (value);
|
||||
celltext->rise_set = TRUE;
|
||||
priv->rise = g_value_get_int (value);
|
||||
priv->rise_set = TRUE;
|
||||
g_object_notify (object, "rise-set");
|
||||
if (celltext->fixed_height_rows != -1)
|
||||
celltext->calc_fixed_height = TRUE;
|
||||
if (priv->fixed_height_rows != -1)
|
||||
priv->calc_fixed_height = TRUE;
|
||||
break;
|
||||
|
||||
case PROP_LANGUAGE:
|
||||
@@ -1264,11 +1284,11 @@ gtk_cell_renderer_text_set_property (GObject *object,
|
||||
break;
|
||||
|
||||
case PROP_BACKGROUND_SET:
|
||||
celltext->background_set = g_value_get_boolean (value);
|
||||
priv->background_set = g_value_get_boolean (value);
|
||||
break;
|
||||
|
||||
case PROP_FOREGROUND_SET:
|
||||
celltext->foreground_set = g_value_get_boolean (value);
|
||||
priv->foreground_set = g_value_get_boolean (value);
|
||||
break;
|
||||
|
||||
case PROP_FAMILY_SET:
|
||||
@@ -1279,37 +1299,37 @@ gtk_cell_renderer_text_set_property (GObject *object,
|
||||
case PROP_SIZE_SET:
|
||||
if (!g_value_get_boolean (value))
|
||||
{
|
||||
pango_font_description_unset_fields (celltext->font,
|
||||
pango_font_description_unset_fields (priv->font,
|
||||
get_property_font_set_mask (param_id));
|
||||
}
|
||||
else
|
||||
{
|
||||
PangoFontMask changed_mask;
|
||||
|
||||
changed_mask = set_font_desc_fields (celltext->font,
|
||||
changed_mask = set_font_desc_fields (priv->font,
|
||||
get_property_font_set_mask (param_id));
|
||||
notify_fields_changed (G_OBJECT (celltext), changed_mask);
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_SCALE_SET:
|
||||
celltext->scale_set = g_value_get_boolean (value);
|
||||
priv->scale_set = g_value_get_boolean (value);
|
||||
break;
|
||||
|
||||
case PROP_EDITABLE_SET:
|
||||
celltext->editable_set = g_value_get_boolean (value);
|
||||
priv->editable_set = g_value_get_boolean (value);
|
||||
break;
|
||||
|
||||
case PROP_STRIKETHROUGH_SET:
|
||||
celltext->strikethrough_set = g_value_get_boolean (value);
|
||||
priv->strikethrough_set = g_value_get_boolean (value);
|
||||
break;
|
||||
|
||||
case PROP_UNDERLINE_SET:
|
||||
celltext->underline_set = g_value_get_boolean (value);
|
||||
priv->underline_set = g_value_get_boolean (value);
|
||||
break;
|
||||
|
||||
case PROP_RISE_SET:
|
||||
celltext->rise_set = g_value_get_boolean (value);
|
||||
priv->rise_set = g_value_get_boolean (value);
|
||||
break;
|
||||
|
||||
case PROP_LANGUAGE_SET:
|
||||
@@ -1365,17 +1385,15 @@ get_layout (GtkCellRendererText *celltext,
|
||||
gboolean will_render,
|
||||
GtkCellRendererState flags)
|
||||
{
|
||||
GtkCellRendererTextPriv *priv = celltext->priv;
|
||||
PangoAttrList *attr_list;
|
||||
PangoLayout *layout;
|
||||
PangoUnderline uline;
|
||||
GtkCellRendererTextPrivate *priv;
|
||||
|
||||
priv = GTK_CELL_RENDERER_TEXT_GET_PRIVATE (celltext);
|
||||
|
||||
layout = gtk_widget_create_pango_layout (widget, celltext->text);
|
||||
layout = gtk_widget_create_pango_layout (widget, priv->text);
|
||||
|
||||
if (celltext->extra_attrs)
|
||||
attr_list = pango_attr_list_copy (celltext->extra_attrs);
|
||||
if (priv->extra_attrs)
|
||||
attr_list = pango_attr_list_copy (priv->extra_attrs);
|
||||
else
|
||||
attr_list = pango_attr_list_new ();
|
||||
|
||||
@@ -1389,30 +1407,30 @@ get_layout (GtkCellRendererText *celltext,
|
||||
* background_area not the PangoLayout area
|
||||
*/
|
||||
|
||||
if (celltext->foreground_set
|
||||
if (priv->foreground_set
|
||||
&& (flags & GTK_CELL_RENDERER_SELECTED) == 0)
|
||||
{
|
||||
PangoColor color;
|
||||
|
||||
color = celltext->foreground;
|
||||
color = priv->foreground;
|
||||
|
||||
add_attr (attr_list,
|
||||
pango_attr_foreground_new (color.red, color.green, color.blue));
|
||||
}
|
||||
|
||||
if (celltext->strikethrough_set)
|
||||
if (priv->strikethrough_set)
|
||||
add_attr (attr_list,
|
||||
pango_attr_strikethrough_new (celltext->strikethrough));
|
||||
pango_attr_strikethrough_new (priv->strikethrough));
|
||||
}
|
||||
|
||||
add_attr (attr_list, pango_attr_font_desc_new (celltext->font));
|
||||
add_attr (attr_list, pango_attr_font_desc_new (priv->font));
|
||||
|
||||
if (celltext->scale_set &&
|
||||
celltext->font_scale != 1.0)
|
||||
add_attr (attr_list, pango_attr_scale_new (celltext->font_scale));
|
||||
if (priv->scale_set &&
|
||||
priv->font_scale != 1.0)
|
||||
add_attr (attr_list, pango_attr_scale_new (priv->font_scale));
|
||||
|
||||
if (celltext->underline_set)
|
||||
uline = celltext->underline_style;
|
||||
if (priv->underline_set)
|
||||
uline = priv->underline_style;
|
||||
else
|
||||
uline = PANGO_UNDERLINE_NONE;
|
||||
|
||||
@@ -1437,10 +1455,10 @@ get_layout (GtkCellRendererText *celltext,
|
||||
}
|
||||
|
||||
if (uline != PANGO_UNDERLINE_NONE)
|
||||
add_attr (attr_list, pango_attr_underline_new (celltext->underline_style));
|
||||
add_attr (attr_list, pango_attr_underline_new (priv->underline_style));
|
||||
|
||||
if (celltext->rise_set)
|
||||
add_attr (attr_list, pango_attr_rise_new (celltext->rise));
|
||||
if (priv->rise_set)
|
||||
add_attr (attr_list, pango_attr_rise_new (priv->rise));
|
||||
|
||||
if (priv->ellipsize_set)
|
||||
pango_layout_set_ellipsize (layout, priv->ellipsize);
|
||||
@@ -1489,13 +1507,15 @@ get_size (GtkCellRenderer *cell,
|
||||
gint *width,
|
||||
gint *height)
|
||||
{
|
||||
GtkCellRendererText *celltext = (GtkCellRendererText *) cell;
|
||||
GtkCellRendererText *celltext = GTK_CELL_RENDERER_TEXT (cell);
|
||||
GtkCellRendererTextPriv *priv = celltext->priv;
|
||||
PangoRectangle rect;
|
||||
GtkCellRendererTextPrivate *priv;
|
||||
gint xpad, ypad;
|
||||
gint cell_width, cell_height;
|
||||
|
||||
priv = GTK_CELL_RENDERER_TEXT_GET_PRIVATE (cell);
|
||||
gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
|
||||
|
||||
if (celltext->calc_fixed_height)
|
||||
if (priv->calc_fixed_height)
|
||||
{
|
||||
PangoContext *context;
|
||||
PangoFontMetrics *metrics;
|
||||
@@ -1503,11 +1523,11 @@ get_size (GtkCellRenderer *cell,
|
||||
gint row_height;
|
||||
|
||||
font_desc = pango_font_description_copy_static (widget->style->font_desc);
|
||||
pango_font_description_merge_static (font_desc, celltext->font, TRUE);
|
||||
pango_font_description_merge_static (font_desc, priv->font, TRUE);
|
||||
|
||||
if (celltext->scale_set)
|
||||
if (priv->scale_set)
|
||||
pango_font_description_set_size (font_desc,
|
||||
celltext->font_scale * pango_font_description_get_size (font_desc));
|
||||
priv->font_scale * pango_font_description_get_size (font_desc));
|
||||
|
||||
context = gtk_widget_get_pango_context (widget);
|
||||
|
||||
@@ -1520,16 +1540,18 @@ get_size (GtkCellRenderer *cell,
|
||||
|
||||
pango_font_description_free (font_desc);
|
||||
|
||||
gtk_cell_renderer_get_fixed_size (cell, &cell_width, &cell_height);
|
||||
|
||||
gtk_cell_renderer_set_fixed_size (cell,
|
||||
cell->width, 2*cell->ypad +
|
||||
celltext->fixed_height_rows * PANGO_PIXELS (row_height));
|
||||
cell_width, 2 * ypad +
|
||||
priv->fixed_height_rows * PANGO_PIXELS (row_height));
|
||||
|
||||
if (height)
|
||||
{
|
||||
*height = cell->height;
|
||||
*height = cell_height;
|
||||
height = NULL;
|
||||
}
|
||||
celltext->calc_fixed_height = FALSE;
|
||||
priv->calc_fixed_height = FALSE;
|
||||
if (width == NULL)
|
||||
return;
|
||||
}
|
||||
@@ -1542,7 +1564,7 @@ get_size (GtkCellRenderer *cell,
|
||||
pango_layout_get_pixel_extents (layout, NULL, &rect);
|
||||
|
||||
if (height)
|
||||
*height = cell->ypad * 2 + rect.height;
|
||||
*height = ypad * 2 + rect.height;
|
||||
|
||||
/* The minimum size for ellipsized labels is ~ 3 chars */
|
||||
if (width)
|
||||
@@ -1559,29 +1581,33 @@ get_size (GtkCellRenderer *cell,
|
||||
char_width = pango_font_metrics_get_approximate_char_width (metrics);
|
||||
pango_font_metrics_unref (metrics);
|
||||
|
||||
*width = cell->xpad * 2 + (PANGO_PIXELS (char_width) * MAX (priv->width_chars, 3));
|
||||
*width = xpad * 2 + (PANGO_PIXELS (char_width) * MAX (priv->width_chars, 3));
|
||||
}
|
||||
else
|
||||
{
|
||||
*width = cell->xpad * 2 + rect.x + rect.width;
|
||||
*width = xpad * 2 + rect.x + rect.width;
|
||||
}
|
||||
}
|
||||
|
||||
if (cell_area)
|
||||
{
|
||||
gfloat xalign, yalign;
|
||||
|
||||
gtk_cell_renderer_get_alignment (cell, &xalign, &yalign);
|
||||
|
||||
if (x_offset)
|
||||
{
|
||||
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
|
||||
*x_offset = (1.0 - cell->xalign) * (cell_area->width - (rect.x + rect.width + (2 * cell->xpad)));
|
||||
*x_offset = (1.0 - xalign) * (cell_area->width - (rect.x + rect.width + (2 * xpad)));
|
||||
else
|
||||
*x_offset = cell->xalign * (cell_area->width - (rect.x + rect.width + (2 * cell->xpad)));
|
||||
*x_offset = xalign * (cell_area->width - (rect.x + rect.width + (2 * xpad)));
|
||||
|
||||
if ((priv->ellipsize_set && priv->ellipsize != PANGO_ELLIPSIZE_NONE) || priv->wrap_width != -1)
|
||||
*x_offset = MAX(*x_offset, 0);
|
||||
}
|
||||
if (y_offset)
|
||||
{
|
||||
*y_offset = cell->yalign * (cell_area->height - (rect.height + (2 * cell->ypad)));
|
||||
*y_offset = yalign * (cell_area->height - (rect.height + (2 * ypad)));
|
||||
*y_offset = MAX (*y_offset, 0);
|
||||
}
|
||||
}
|
||||
@@ -1618,19 +1644,18 @@ gtk_cell_renderer_text_render (GtkCellRenderer *cell,
|
||||
GtkCellRendererState flags)
|
||||
|
||||
{
|
||||
GtkCellRendererText *celltext = (GtkCellRendererText *) cell;
|
||||
GtkCellRendererText *celltext = GTK_CELL_RENDERER_TEXT (cell);
|
||||
GtkCellRendererTextPriv *priv = celltext->priv;
|
||||
PangoLayout *layout;
|
||||
GtkStateType state;
|
||||
gint x_offset;
|
||||
gint y_offset;
|
||||
GtkCellRendererTextPrivate *priv;
|
||||
|
||||
priv = GTK_CELL_RENDERER_TEXT_GET_PRIVATE (cell);
|
||||
gint xpad, ypad;
|
||||
|
||||
layout = get_layout (celltext, widget, TRUE, flags);
|
||||
get_size (cell, widget, cell_area, layout, &x_offset, &y_offset, NULL, NULL);
|
||||
|
||||
if (!cell->sensitive)
|
||||
if (!gtk_cell_renderer_get_sensitive (cell))
|
||||
{
|
||||
state = GTK_STATE_INSENSITIVE;
|
||||
}
|
||||
@@ -1654,7 +1679,7 @@ gtk_cell_renderer_text_render (GtkCellRenderer *cell,
|
||||
state = GTK_STATE_NORMAL;
|
||||
}
|
||||
|
||||
if (celltext->background_set &&
|
||||
if (priv->background_set &&
|
||||
(flags & GTK_CELL_RENDERER_SELECTED) == 0)
|
||||
{
|
||||
cairo_t *cr = gdk_cairo_create (window);
|
||||
@@ -1667,17 +1692,19 @@ gtk_cell_renderer_text_render (GtkCellRenderer *cell,
|
||||
|
||||
gdk_cairo_rectangle (cr, background_area);
|
||||
cairo_set_source_rgb (cr,
|
||||
celltext->background.red / 65535.,
|
||||
celltext->background.green / 65535.,
|
||||
celltext->background.blue / 65535.);
|
||||
priv->background.red / 65535.,
|
||||
priv->background.green / 65535.,
|
||||
priv->background.blue / 65535.);
|
||||
cairo_fill (cr);
|
||||
|
||||
cairo_destroy (cr);
|
||||
}
|
||||
|
||||
gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
|
||||
|
||||
if (priv->ellipsize_set && priv->ellipsize != PANGO_ELLIPSIZE_NONE)
|
||||
pango_layout_set_width (layout,
|
||||
(cell_area->width - x_offset - 2 * cell->xpad) * PANGO_SCALE);
|
||||
(cell_area->width - x_offset - 2 * xpad) * PANGO_SCALE);
|
||||
else if (priv->wrap_width == -1)
|
||||
pango_layout_set_width (layout, -1);
|
||||
|
||||
@@ -1688,8 +1715,8 @@ gtk_cell_renderer_text_render (GtkCellRenderer *cell,
|
||||
expose_area,
|
||||
widget,
|
||||
"cellrenderertext",
|
||||
cell_area->x + x_offset + cell->xpad,
|
||||
cell_area->y + y_offset + cell->ypad,
|
||||
cell_area->x + x_offset + xpad,
|
||||
cell_area->y + y_offset + ypad,
|
||||
layout);
|
||||
|
||||
g_object_unref (layout);
|
||||
@@ -1699,12 +1726,12 @@ static void
|
||||
gtk_cell_renderer_text_editing_done (GtkCellEditable *entry,
|
||||
gpointer data)
|
||||
{
|
||||
GtkCellRendererTextPriv *priv;
|
||||
const gchar *path;
|
||||
const gchar *new_text;
|
||||
gboolean canceled;
|
||||
GtkCellRendererTextPrivate *priv;
|
||||
|
||||
priv = GTK_CELL_RENDERER_TEXT_GET_PRIVATE (data);
|
||||
priv = GTK_CELL_RENDERER_TEXT (data)->priv;
|
||||
|
||||
priv->entry = NULL;
|
||||
|
||||
@@ -1743,9 +1770,9 @@ gtk_cell_renderer_text_editing_done (GtkCellEditable *entry,
|
||||
static gboolean
|
||||
popdown_timeout (gpointer data)
|
||||
{
|
||||
GtkCellRendererTextPrivate *priv;
|
||||
GtkCellRendererTextPriv *priv;
|
||||
|
||||
priv = GTK_CELL_RENDERER_TEXT_GET_PRIVATE (data);
|
||||
priv = GTK_CELL_RENDERER_TEXT (data)->priv;
|
||||
|
||||
priv->entry_menu_popdown_timeout = 0;
|
||||
|
||||
@@ -1759,9 +1786,9 @@ static void
|
||||
gtk_cell_renderer_text_popup_unmap (GtkMenu *menu,
|
||||
gpointer data)
|
||||
{
|
||||
GtkCellRendererTextPrivate *priv;
|
||||
GtkCellRendererTextPriv *priv;
|
||||
|
||||
priv = GTK_CELL_RENDERER_TEXT_GET_PRIVATE (data);
|
||||
priv = GTK_CELL_RENDERER_TEXT (data)->priv;
|
||||
|
||||
priv->in_entry_menu = FALSE;
|
||||
|
||||
@@ -1777,9 +1804,9 @@ gtk_cell_renderer_text_populate_popup (GtkEntry *entry,
|
||||
GtkMenu *menu,
|
||||
gpointer data)
|
||||
{
|
||||
GtkCellRendererTextPrivate *priv;
|
||||
GtkCellRendererTextPriv *priv;
|
||||
|
||||
priv = GTK_CELL_RENDERER_TEXT_GET_PRIVATE (data);
|
||||
priv = GTK_CELL_RENDERER_TEXT (data)->priv;
|
||||
|
||||
if (priv->entry_menu_popdown_timeout)
|
||||
{
|
||||
@@ -1798,9 +1825,9 @@ gtk_cell_renderer_text_focus_out_event (GtkWidget *entry,
|
||||
GdkEvent *event,
|
||||
gpointer data)
|
||||
{
|
||||
GtkCellRendererTextPrivate *priv;
|
||||
GtkCellRendererTextPriv *priv;
|
||||
|
||||
priv = GTK_CELL_RENDERER_TEXT_GET_PRIVATE (data);
|
||||
priv = GTK_CELL_RENDERER_TEXT (data)->priv;
|
||||
|
||||
if (priv->in_entry_menu)
|
||||
return FALSE;
|
||||
@@ -1826,22 +1853,24 @@ gtk_cell_renderer_text_start_editing (GtkCellRenderer *cell,
|
||||
{
|
||||
GtkRequisition requisition;
|
||||
GtkCellRendererText *celltext;
|
||||
GtkCellRendererTextPrivate *priv;
|
||||
GtkCellRendererTextPriv *priv;
|
||||
gfloat xalign, yalign;
|
||||
|
||||
celltext = GTK_CELL_RENDERER_TEXT (cell);
|
||||
priv = GTK_CELL_RENDERER_TEXT_GET_PRIVATE (cell);
|
||||
priv = celltext->priv;
|
||||
|
||||
/* If the cell isn't editable we return NULL. */
|
||||
if (celltext->editable == FALSE)
|
||||
if (priv->editable == FALSE)
|
||||
return NULL;
|
||||
|
||||
priv->entry = g_object_new (GTK_TYPE_ENTRY,
|
||||
"has-frame", FALSE,
|
||||
"xalign", cell->xalign,
|
||||
NULL);
|
||||
gtk_cell_renderer_get_alignment (cell, &xalign, &yalign);
|
||||
|
||||
if (celltext->text)
|
||||
gtk_entry_set_text (GTK_ENTRY (priv->entry), celltext->text);
|
||||
priv->entry = gtk_entry_new ();
|
||||
gtk_entry_set_has_frame (GTK_ENTRY (priv->entry), FALSE);
|
||||
gtk_entry_set_alignment (GTK_ENTRY (priv->entry), xalign);
|
||||
|
||||
if (priv->text)
|
||||
gtk_entry_set_text (GTK_ENTRY (priv->entry), priv->text);
|
||||
g_object_set_data_full (G_OBJECT (priv->entry), I_(GTK_CELL_RENDERER_TEXT_PATH), g_strdup (path), g_free);
|
||||
|
||||
gtk_editable_select_region (GTK_EDITABLE (priv->entry), 0, -1);
|
||||
@@ -1914,18 +1943,25 @@ void
|
||||
gtk_cell_renderer_text_set_fixed_height_from_font (GtkCellRendererText *renderer,
|
||||
gint number_of_rows)
|
||||
{
|
||||
GtkCellRendererTextPriv *priv;
|
||||
GtkCellRenderer *cell;
|
||||
|
||||
g_return_if_fail (GTK_IS_CELL_RENDERER_TEXT (renderer));
|
||||
g_return_if_fail (number_of_rows == -1 || number_of_rows > 0);
|
||||
|
||||
cell = GTK_CELL_RENDERER (renderer);
|
||||
priv = renderer->priv;
|
||||
|
||||
if (number_of_rows == -1)
|
||||
{
|
||||
gtk_cell_renderer_set_fixed_size (GTK_CELL_RENDERER (renderer),
|
||||
GTK_CELL_RENDERER (renderer)->width,
|
||||
-1);
|
||||
gint width, height;
|
||||
|
||||
gtk_cell_renderer_get_fixed_size (cell, &width, &height);
|
||||
gtk_cell_renderer_set_fixed_size (cell, width, -1);
|
||||
}
|
||||
else
|
||||
{
|
||||
renderer->fixed_height_rows = number_of_rows;
|
||||
renderer->calc_fixed_height = TRUE;
|
||||
priv->fixed_height_rows = number_of_rows;
|
||||
priv->calc_fixed_height = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ G_BEGIN_DECLS
|
||||
#define GTK_CELL_RENDERER_TEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CELL_RENDERER_TEXT, GtkCellRendererTextClass))
|
||||
|
||||
typedef struct _GtkCellRendererText GtkCellRendererText;
|
||||
typedef struct _GtkCellRendererTextPriv GtkCellRendererTextPriv;
|
||||
typedef struct _GtkCellRendererTextClass GtkCellRendererTextClass;
|
||||
|
||||
struct _GtkCellRendererText
|
||||
@@ -46,36 +47,7 @@ struct _GtkCellRendererText
|
||||
GtkCellRenderer parent;
|
||||
|
||||
/*< private >*/
|
||||
gchar *GSEAL (text);
|
||||
PangoFontDescription *GSEAL (font);
|
||||
gdouble GSEAL (font_scale);
|
||||
PangoColor GSEAL (foreground);
|
||||
PangoColor GSEAL (background);
|
||||
|
||||
PangoAttrList *GSEAL (extra_attrs);
|
||||
|
||||
PangoUnderline GSEAL (underline_style);
|
||||
|
||||
gint GSEAL (rise);
|
||||
gint GSEAL (fixed_height_rows);
|
||||
|
||||
guint GSEAL (strikethrough) : 1;
|
||||
|
||||
guint GSEAL (editable) : 1;
|
||||
|
||||
guint GSEAL (scale_set) : 1;
|
||||
|
||||
guint GSEAL (foreground_set) : 1;
|
||||
guint GSEAL (background_set) : 1;
|
||||
|
||||
guint GSEAL (underline_set) : 1;
|
||||
|
||||
guint GSEAL (rise_set) : 1;
|
||||
|
||||
guint GSEAL (strikethrough_set) : 1;
|
||||
|
||||
guint GSEAL (editable_set) : 1;
|
||||
guint GSEAL (calc_fixed_height) : 1;
|
||||
GtkCellRendererTextPriv *priv;
|
||||
};
|
||||
|
||||
struct _GtkCellRendererTextClass
|
||||
|
||||
@@ -75,33 +75,36 @@ enum {
|
||||
|
||||
static guint toggle_cell_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
#define GTK_CELL_RENDERER_TOGGLE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_CELL_RENDERER_TOGGLE, GtkCellRendererTogglePrivate))
|
||||
|
||||
typedef struct _GtkCellRendererTogglePrivate GtkCellRendererTogglePrivate;
|
||||
struct _GtkCellRendererTogglePrivate
|
||||
struct _GtkCellRendererTogglePriv
|
||||
{
|
||||
gint indicator_size;
|
||||
|
||||
guint active : 1;
|
||||
guint activatable : 1;
|
||||
guint inconsistent : 1;
|
||||
guint radio : 1;
|
||||
};
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GtkCellRendererToggle, gtk_cell_renderer_toggle, GTK_TYPE_CELL_RENDERER)
|
||||
|
||||
|
||||
static void
|
||||
gtk_cell_renderer_toggle_init (GtkCellRendererToggle *celltoggle)
|
||||
{
|
||||
GtkCellRendererTogglePrivate *priv;
|
||||
GtkCellRendererTogglePriv *priv;
|
||||
|
||||
priv = GTK_CELL_RENDERER_TOGGLE_GET_PRIVATE (celltoggle);
|
||||
celltoggle->priv = G_TYPE_INSTANCE_GET_PRIVATE (celltoggle,
|
||||
GTK_TYPE_CELL_RENDERER_TOGGLE,
|
||||
GtkCellRendererTogglePriv);
|
||||
priv = celltoggle->priv;
|
||||
|
||||
celltoggle->activatable = TRUE;
|
||||
celltoggle->active = FALSE;
|
||||
celltoggle->radio = FALSE;
|
||||
priv->activatable = TRUE;
|
||||
priv->active = FALSE;
|
||||
priv->radio = FALSE;
|
||||
|
||||
GTK_CELL_RENDERER (celltoggle)->mode = GTK_CELL_RENDERER_MODE_ACTIVATABLE;
|
||||
GTK_CELL_RENDERER (celltoggle)->xpad = 2;
|
||||
GTK_CELL_RENDERER (celltoggle)->ypad = 2;
|
||||
g_object_set (celltoggle, "mode", GTK_CELL_RENDERER_MODE_ACTIVATABLE, NULL);
|
||||
gtk_cell_renderer_set_padding (GTK_CELL_RENDERER (celltoggle), 2, 2);
|
||||
|
||||
priv->indicator_size = TOGGLE_WIDTH;
|
||||
priv->inconsistent = FALSE;
|
||||
@@ -181,7 +184,7 @@ gtk_cell_renderer_toggle_class_init (GtkCellRendererToggleClass *class)
|
||||
G_TYPE_NONE, 1,
|
||||
G_TYPE_STRING);
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (GtkCellRendererTogglePrivate));
|
||||
g_type_class_add_private (object_class, sizeof (GtkCellRendererTogglePriv));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -191,23 +194,21 @@ gtk_cell_renderer_toggle_get_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkCellRendererToggle *celltoggle = GTK_CELL_RENDERER_TOGGLE (object);
|
||||
GtkCellRendererTogglePrivate *priv;
|
||||
GtkCellRendererTogglePriv *priv = celltoggle->priv;
|
||||
|
||||
priv = GTK_CELL_RENDERER_TOGGLE_GET_PRIVATE (object);
|
||||
|
||||
switch (param_id)
|
||||
{
|
||||
case PROP_ACTIVE:
|
||||
g_value_set_boolean (value, celltoggle->active);
|
||||
g_value_set_boolean (value, priv->active);
|
||||
break;
|
||||
case PROP_INCONSISTENT:
|
||||
g_value_set_boolean (value, priv->inconsistent);
|
||||
break;
|
||||
case PROP_ACTIVATABLE:
|
||||
g_value_set_boolean (value, celltoggle->activatable);
|
||||
g_value_set_boolean (value, priv->activatable);
|
||||
break;
|
||||
case PROP_RADIO:
|
||||
g_value_set_boolean (value, celltoggle->radio);
|
||||
g_value_set_boolean (value, priv->radio);
|
||||
break;
|
||||
case PROP_INDICATOR_SIZE:
|
||||
g_value_set_int (value, priv->indicator_size);
|
||||
@@ -226,23 +227,21 @@ gtk_cell_renderer_toggle_set_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkCellRendererToggle *celltoggle = GTK_CELL_RENDERER_TOGGLE (object);
|
||||
GtkCellRendererTogglePrivate *priv;
|
||||
|
||||
priv = GTK_CELL_RENDERER_TOGGLE_GET_PRIVATE (object);
|
||||
GtkCellRendererTogglePriv *priv = celltoggle->priv;
|
||||
|
||||
switch (param_id)
|
||||
{
|
||||
case PROP_ACTIVE:
|
||||
celltoggle->active = g_value_get_boolean (value);
|
||||
priv->active = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_INCONSISTENT:
|
||||
priv->inconsistent = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_ACTIVATABLE:
|
||||
celltoggle->activatable = g_value_get_boolean (value);
|
||||
priv->activatable = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_RADIO:
|
||||
celltoggle->radio = g_value_get_boolean (value);
|
||||
priv->radio = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_INDICATOR_SIZE:
|
||||
priv->indicator_size = g_value_get_int (value);
|
||||
@@ -281,14 +280,16 @@ gtk_cell_renderer_toggle_get_size (GtkCellRenderer *cell,
|
||||
gint *width,
|
||||
gint *height)
|
||||
{
|
||||
GtkCellRendererTogglePriv *priv;
|
||||
gint calc_width;
|
||||
gint calc_height;
|
||||
GtkCellRendererTogglePrivate *priv;
|
||||
gint xpad, ypad;
|
||||
|
||||
priv = GTK_CELL_RENDERER_TOGGLE_GET_PRIVATE (cell);
|
||||
priv = GTK_CELL_RENDERER_TOGGLE (cell)->priv;
|
||||
|
||||
calc_width = (gint) cell->xpad * 2 + priv->indicator_size;
|
||||
calc_height = (gint) cell->ypad * 2 + priv->indicator_size;
|
||||
gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
|
||||
calc_width = xpad * 2 + priv->indicator_size;
|
||||
calc_height = ypad * 2 + priv->indicator_size;
|
||||
|
||||
if (width)
|
||||
*width = calc_width;
|
||||
@@ -298,15 +299,19 @@ gtk_cell_renderer_toggle_get_size (GtkCellRenderer *cell,
|
||||
|
||||
if (cell_area)
|
||||
{
|
||||
gfloat xalign, yalign;
|
||||
|
||||
gtk_cell_renderer_get_alignment (cell, &xalign, &yalign);
|
||||
|
||||
if (x_offset)
|
||||
{
|
||||
*x_offset = ((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ?
|
||||
(1.0 - cell->xalign) : cell->xalign) * (cell_area->width - calc_width);
|
||||
(1.0 - xalign) : xalign) * (cell_area->width - calc_width);
|
||||
*x_offset = MAX (*x_offset, 0);
|
||||
}
|
||||
if (y_offset)
|
||||
{
|
||||
*y_offset = cell->yalign * (cell_area->height - calc_height);
|
||||
*y_offset = yalign * (cell_area->height - calc_height);
|
||||
*y_offset = MAX (*y_offset, 0);
|
||||
}
|
||||
}
|
||||
@@ -326,20 +331,20 @@ gtk_cell_renderer_toggle_render (GtkCellRenderer *cell,
|
||||
GdkRectangle *expose_area,
|
||||
GtkCellRendererState flags)
|
||||
{
|
||||
GtkCellRendererToggle *celltoggle = (GtkCellRendererToggle *) cell;
|
||||
GtkCellRendererTogglePrivate *priv;
|
||||
GtkCellRendererToggle *celltoggle = GTK_CELL_RENDERER_TOGGLE (cell);
|
||||
GtkCellRendererTogglePriv *priv = celltoggle->priv;
|
||||
gint width, height;
|
||||
gint x_offset, y_offset;
|
||||
gint xpad, ypad;
|
||||
GtkShadowType shadow;
|
||||
GtkStateType state = 0;
|
||||
|
||||
priv = GTK_CELL_RENDERER_TOGGLE_GET_PRIVATE (cell);
|
||||
|
||||
gtk_cell_renderer_toggle_get_size (cell, widget, cell_area,
|
||||
&x_offset, &y_offset,
|
||||
&width, &height);
|
||||
width -= cell->xpad*2;
|
||||
height -= cell->ypad*2;
|
||||
gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
|
||||
width -= xpad * 2;
|
||||
height -= ypad * 2;
|
||||
|
||||
if (width <= 0 || height <= 0)
|
||||
return;
|
||||
@@ -347,9 +352,10 @@ gtk_cell_renderer_toggle_render (GtkCellRenderer *cell,
|
||||
if (priv->inconsistent)
|
||||
shadow = GTK_SHADOW_ETCHED_IN;
|
||||
else
|
||||
shadow = celltoggle->active ? GTK_SHADOW_IN : GTK_SHADOW_OUT;
|
||||
shadow = priv->active ? GTK_SHADOW_IN : GTK_SHADOW_OUT;
|
||||
|
||||
if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE || !cell->sensitive)
|
||||
if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE ||
|
||||
!gtk_cell_renderer_get_sensitive (cell))
|
||||
{
|
||||
state = GTK_STATE_INSENSITIVE;
|
||||
}
|
||||
@@ -362,20 +368,20 @@ gtk_cell_renderer_toggle_render (GtkCellRenderer *cell,
|
||||
}
|
||||
else
|
||||
{
|
||||
if (celltoggle->activatable)
|
||||
if (priv->activatable)
|
||||
state = GTK_STATE_NORMAL;
|
||||
else
|
||||
state = GTK_STATE_INSENSITIVE;
|
||||
}
|
||||
|
||||
if (celltoggle->radio)
|
||||
if (priv->radio)
|
||||
{
|
||||
gtk_paint_option (widget->style,
|
||||
window,
|
||||
state, shadow,
|
||||
expose_area, widget, "cellradio",
|
||||
cell_area->x + x_offset + cell->xpad,
|
||||
cell_area->y + y_offset + cell->ypad,
|
||||
cell_area->x + x_offset + xpad,
|
||||
cell_area->y + y_offset + ypad,
|
||||
width, height);
|
||||
}
|
||||
else
|
||||
@@ -384,8 +390,8 @@ gtk_cell_renderer_toggle_render (GtkCellRenderer *cell,
|
||||
window,
|
||||
state, shadow,
|
||||
expose_area, widget, "cellcheck",
|
||||
cell_area->x + x_offset + cell->xpad,
|
||||
cell_area->y + y_offset + cell->ypad,
|
||||
cell_area->x + x_offset + xpad,
|
||||
cell_area->y + y_offset + ypad,
|
||||
width, height);
|
||||
}
|
||||
}
|
||||
@@ -399,10 +405,13 @@ gtk_cell_renderer_toggle_activate (GtkCellRenderer *cell,
|
||||
GdkRectangle *cell_area,
|
||||
GtkCellRendererState flags)
|
||||
{
|
||||
GtkCellRendererTogglePriv *priv;
|
||||
GtkCellRendererToggle *celltoggle;
|
||||
|
||||
|
||||
celltoggle = GTK_CELL_RENDERER_TOGGLE (cell);
|
||||
if (celltoggle->activatable)
|
||||
priv = celltoggle->priv;
|
||||
|
||||
if (priv->activatable)
|
||||
{
|
||||
g_signal_emit (cell, toggle_cell_signals[TOGGLED], 0, path);
|
||||
return TRUE;
|
||||
@@ -428,9 +437,13 @@ void
|
||||
gtk_cell_renderer_toggle_set_radio (GtkCellRendererToggle *toggle,
|
||||
gboolean radio)
|
||||
{
|
||||
GtkCellRendererTogglePriv *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_CELL_RENDERER_TOGGLE (toggle));
|
||||
|
||||
toggle->radio = radio;
|
||||
priv = toggle->priv;
|
||||
|
||||
priv->radio = radio;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -446,7 +459,7 @@ gtk_cell_renderer_toggle_get_radio (GtkCellRendererToggle *toggle)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_CELL_RENDERER_TOGGLE (toggle), FALSE);
|
||||
|
||||
return toggle->radio;
|
||||
return toggle->priv->radio;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -463,7 +476,7 @@ gtk_cell_renderer_toggle_get_active (GtkCellRendererToggle *toggle)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_CELL_RENDERER_TOGGLE (toggle), FALSE);
|
||||
|
||||
return toggle->active;
|
||||
return toggle->priv->active;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -498,7 +511,7 @@ gtk_cell_renderer_toggle_get_activatable (GtkCellRendererToggle *toggle)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_CELL_RENDERER_TOGGLE (toggle), FALSE);
|
||||
|
||||
return toggle->activatable;
|
||||
return toggle->priv->activatable;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -514,11 +527,15 @@ void
|
||||
gtk_cell_renderer_toggle_set_activatable (GtkCellRendererToggle *toggle,
|
||||
gboolean setting)
|
||||
{
|
||||
GtkCellRendererTogglePriv *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_CELL_RENDERER_TOGGLE (toggle));
|
||||
|
||||
if (toggle->activatable != setting)
|
||||
priv = toggle->priv;
|
||||
|
||||
if (priv->activatable != setting)
|
||||
{
|
||||
toggle->activatable = setting ? TRUE : FALSE;
|
||||
priv->activatable = setting ? TRUE : FALSE;
|
||||
g_object_notify (G_OBJECT (toggle), "activatable");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,8 @@ G_BEGIN_DECLS
|
||||
#define GTK_IS_CELL_RENDERER_TOGGLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CELL_RENDERER_TOGGLE))
|
||||
#define GTK_CELL_RENDERER_TOGGLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CELL_RENDERER_TOGGLE, GtkCellRendererToggleClass))
|
||||
|
||||
typedef struct _GtkCellRendererToggle GtkCellRendererToggle;
|
||||
typedef struct _GtkCellRendererToggle GtkCellRendererToggle;
|
||||
typedef struct _GtkCellRendererTogglePriv GtkCellRendererTogglePriv;
|
||||
typedef struct _GtkCellRendererToggleClass GtkCellRendererToggleClass;
|
||||
|
||||
struct _GtkCellRendererToggle
|
||||
@@ -45,9 +46,7 @@ struct _GtkCellRendererToggle
|
||||
GtkCellRenderer parent;
|
||||
|
||||
/*< private >*/
|
||||
guint GSEAL (active) : 1;
|
||||
guint GSEAL (activatable) : 1;
|
||||
guint GSEAL (radio) : 1;
|
||||
GtkCellRendererTogglePriv *priv;
|
||||
};
|
||||
|
||||
struct _GtkCellRendererToggleClass
|
||||
|
||||
@@ -122,7 +122,6 @@ static void gtk_cell_view_buildable_custom_tag_end (GtkBuildable
|
||||
|
||||
static GtkBuildableIface *parent_buildable_iface;
|
||||
|
||||
#define GTK_CELL_VIEW_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_CELL_VIEW, GtkCellViewPrivate))
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -288,9 +287,14 @@ gtk_cell_view_set_property (GObject *object,
|
||||
static void
|
||||
gtk_cell_view_init (GtkCellView *cellview)
|
||||
{
|
||||
gtk_widget_set_has_window (GTK_WIDGET (cellview), FALSE);
|
||||
GtkCellViewPrivate *priv;
|
||||
|
||||
cellview->priv = GTK_CELL_VIEW_GET_PRIVATE (cellview);
|
||||
cellview->priv = G_TYPE_INSTANCE_GET_PRIVATE (cellview,
|
||||
GTK_TYPE_CELL_VIEW,
|
||||
GtkCellViewPrivate);
|
||||
priv = cellview->priv;
|
||||
|
||||
gtk_widget_set_has_window (GTK_WIDGET (cellview), FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -330,7 +334,7 @@ gtk_cell_view_size_request (GtkWidget *widget,
|
||||
gint width, height;
|
||||
GtkCellViewCellInfo *info = (GtkCellViewCellInfo *)i->data;
|
||||
|
||||
if (!info->cell->visible)
|
||||
if (!gtk_cell_renderer_get_visible (info->cell))
|
||||
continue;
|
||||
|
||||
if (!first_cell)
|
||||
@@ -366,7 +370,7 @@ gtk_cell_view_size_allocate (GtkWidget *widget,
|
||||
{
|
||||
GtkCellViewCellInfo *info = (GtkCellViewCellInfo *)i->data;
|
||||
|
||||
if (!info->cell->visible)
|
||||
if (!gtk_cell_renderer_get_visible (info->cell))
|
||||
continue;
|
||||
|
||||
if (info->expand)
|
||||
@@ -385,7 +389,7 @@ gtk_cell_view_size_allocate (GtkWidget *widget,
|
||||
{
|
||||
GtkCellViewCellInfo *info = (GtkCellViewCellInfo *)i->data;
|
||||
|
||||
if (!info->cell->visible)
|
||||
if (!gtk_cell_renderer_get_visible (info->cell))
|
||||
continue;
|
||||
|
||||
info->real_width = info->requested_width +
|
||||
@@ -451,7 +455,7 @@ gtk_cell_view_expose (GtkWidget *widget,
|
||||
if (info->pack == GTK_PACK_END)
|
||||
continue;
|
||||
|
||||
if (!info->cell->visible)
|
||||
if (!gtk_cell_renderer_get_visible (info->cell))
|
||||
continue;
|
||||
|
||||
area.width = info->real_width;
|
||||
@@ -478,7 +482,7 @@ gtk_cell_view_expose (GtkWidget *widget,
|
||||
if (info->pack == GTK_PACK_START)
|
||||
continue;
|
||||
|
||||
if (!info->cell->visible)
|
||||
if (!gtk_cell_renderer_get_visible (info->cell))
|
||||
continue;
|
||||
|
||||
area.width = info->real_width;
|
||||
|
||||
@@ -46,7 +46,7 @@ struct _GtkCellView
|
||||
GtkWidget parent_instance;
|
||||
|
||||
/*< private >*/
|
||||
GtkCellViewPrivate *GSEAL (priv);
|
||||
GtkCellViewPrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkCellViewClass
|
||||
|
||||
@@ -146,11 +146,11 @@ gtk_check_button_paint (GtkWidget *widget,
|
||||
NULL);
|
||||
|
||||
gtk_check_button_draw_indicator (check_button, area);
|
||||
|
||||
border_width = GTK_CONTAINER (widget)->border_width;
|
||||
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||
if (gtk_widget_has_focus (widget))
|
||||
{
|
||||
GtkWidget *child = GTK_BIN (widget)->child;
|
||||
GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget));
|
||||
|
||||
if (interior_focus && child && gtk_widget_get_visible (child))
|
||||
gtk_paint_focus (widget->style, widget->window, gtk_widget_get_state (widget),
|
||||
@@ -196,9 +196,11 @@ gtk_check_button_size_request (GtkWidget *widget,
|
||||
gint temp;
|
||||
gint indicator_size;
|
||||
gint indicator_spacing;
|
||||
gint border_width = GTK_CONTAINER (widget)->border_width;
|
||||
gint focus_width;
|
||||
gint focus_pad;
|
||||
guint border_width;
|
||||
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||
|
||||
gtk_widget_style_get (GTK_WIDGET (widget),
|
||||
"focus-line-width", &focus_width,
|
||||
@@ -211,7 +213,7 @@ gtk_check_button_size_request (GtkWidget *widget,
|
||||
_gtk_check_button_get_props (GTK_CHECK_BUTTON (widget),
|
||||
&indicator_size, &indicator_spacing);
|
||||
|
||||
child = GTK_BIN (widget)->child;
|
||||
child = gtk_bin_get_child (GTK_BIN (widget));
|
||||
if (child && gtk_widget_get_visible (child))
|
||||
{
|
||||
GtkRequisition child_requisition;
|
||||
@@ -246,6 +248,7 @@ gtk_check_button_size_allocate (GtkWidget *widget,
|
||||
|
||||
if (toggle_button->draw_indicator)
|
||||
{
|
||||
GtkWidget *child;
|
||||
gint indicator_size;
|
||||
gint indicator_spacing;
|
||||
gint focus_width;
|
||||
@@ -262,13 +265,14 @@ gtk_check_button_size_allocate (GtkWidget *widget,
|
||||
gdk_window_move_resize (button->event_window,
|
||||
allocation->x, allocation->y,
|
||||
allocation->width, allocation->height);
|
||||
|
||||
if (GTK_BIN (button)->child && gtk_widget_get_visible (GTK_BIN (button)->child))
|
||||
|
||||
child = gtk_bin_get_child (GTK_BIN (button));
|
||||
if (child && gtk_widget_get_visible (child))
|
||||
{
|
||||
GtkRequisition child_requisition;
|
||||
gint border_width = GTK_CONTAINER (widget)->border_width;
|
||||
guint border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||
|
||||
gtk_widget_get_child_requisition (GTK_BIN (button)->child, &child_requisition);
|
||||
gtk_widget_get_child_requisition (child, &child_requisition);
|
||||
|
||||
child_allocation.width = MIN (child_requisition.width,
|
||||
allocation->width -
|
||||
@@ -289,7 +293,7 @@ gtk_check_button_size_allocate (GtkWidget *widget,
|
||||
child_allocation.x = allocation->x + allocation->width
|
||||
- (child_allocation.x - allocation->x + child_allocation.width);
|
||||
|
||||
gtk_widget_size_allocate (GTK_BIN (button)->child, &child_allocation);
|
||||
gtk_widget_size_allocate (child, &child_allocation);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -302,6 +306,7 @@ gtk_check_button_expose (GtkWidget *widget,
|
||||
{
|
||||
GtkToggleButton *toggle_button;
|
||||
GtkBin *bin;
|
||||
GtkWidget *child;
|
||||
|
||||
toggle_button = GTK_TOGGLE_BUTTON (widget);
|
||||
bin = GTK_BIN (widget);
|
||||
@@ -311,10 +316,11 @@ gtk_check_button_expose (GtkWidget *widget,
|
||||
if (toggle_button->draw_indicator)
|
||||
{
|
||||
gtk_check_button_paint (widget, &event->area);
|
||||
|
||||
if (bin->child)
|
||||
|
||||
child = gtk_bin_get_child (bin);
|
||||
if (child)
|
||||
gtk_container_propagate_expose (GTK_CONTAINER (widget),
|
||||
bin->child,
|
||||
child,
|
||||
event);
|
||||
}
|
||||
else if (GTK_WIDGET_CLASS (gtk_check_button_parent_class)->expose_event)
|
||||
@@ -354,6 +360,7 @@ gtk_real_check_button_draw_indicator (GtkCheckButton *check_button,
|
||||
gint indicator_spacing;
|
||||
gint focus_width;
|
||||
gint focus_pad;
|
||||
guint border_width;
|
||||
gboolean interior_focus;
|
||||
|
||||
widget = GTK_WIDGET (check_button);
|
||||
@@ -371,10 +378,12 @@ gtk_real_check_button_draw_indicator (GtkCheckButton *check_button,
|
||||
|
||||
_gtk_check_button_get_props (check_button, &indicator_size, &indicator_spacing);
|
||||
|
||||
x = widget->allocation.x + indicator_spacing + GTK_CONTAINER (widget)->border_width;
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||
|
||||
x = widget->allocation.x + indicator_spacing + border_width;
|
||||
y = widget->allocation.y + (widget->allocation.height - indicator_size) / 2;
|
||||
|
||||
child = GTK_BIN (check_button)->child;
|
||||
child = gtk_bin_get_child (GTK_BIN (check_button));
|
||||
if (!interior_focus || !(child && gtk_widget_get_visible (child)))
|
||||
x += focus_width + focus_pad;
|
||||
|
||||
@@ -402,10 +411,10 @@ gtk_real_check_button_draw_indicator (GtkCheckButton *check_button,
|
||||
GdkRectangle restrict_area;
|
||||
GdkRectangle new_area;
|
||||
|
||||
restrict_area.x = widget->allocation.x + GTK_CONTAINER (widget)->border_width;
|
||||
restrict_area.y = widget->allocation.y + GTK_CONTAINER (widget)->border_width;
|
||||
restrict_area.width = widget->allocation.width - (2 * GTK_CONTAINER (widget)->border_width);
|
||||
restrict_area.height = widget->allocation.height - (2 * GTK_CONTAINER (widget)->border_width);
|
||||
restrict_area.x = widget->allocation.x + border_width;
|
||||
restrict_area.y = widget->allocation.y + border_width;
|
||||
restrict_area.width = widget->allocation.width - (2 * border_width);
|
||||
restrict_area.height = widget->allocation.height - (2 * border_width);
|
||||
|
||||
if (gdk_rectangle_intersect (area, &restrict_area, &new_area))
|
||||
{
|
||||
|
||||
@@ -34,6 +34,15 @@
|
||||
#include "gtkintl.h"
|
||||
|
||||
|
||||
|
||||
struct _GtkCheckMenuItemPriv
|
||||
{
|
||||
guint active : 1;
|
||||
guint always_show_toggle : 1;
|
||||
guint draw_as_radio : 1;
|
||||
guint inconsistent : 1;
|
||||
};
|
||||
|
||||
enum {
|
||||
TOGGLED,
|
||||
LAST_SIGNAL
|
||||
@@ -142,6 +151,8 @@ gtk_check_menu_item_class_init (GtkCheckMenuItemClass *klass)
|
||||
NULL, NULL,
|
||||
_gtk_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
g_type_class_add_private (klass, sizeof (GtkCheckMenuItemPriv));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -240,11 +251,15 @@ void
|
||||
gtk_check_menu_item_set_active (GtkCheckMenuItem *check_menu_item,
|
||||
gboolean is_active)
|
||||
{
|
||||
GtkCheckMenuItemPriv *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item));
|
||||
|
||||
priv = check_menu_item->priv;
|
||||
|
||||
is_active = is_active != 0;
|
||||
|
||||
if (check_menu_item->active != is_active)
|
||||
if (priv->active != is_active)
|
||||
gtk_menu_item_activate (GTK_MENU_ITEM (check_menu_item));
|
||||
}
|
||||
|
||||
@@ -262,7 +277,7 @@ gtk_check_menu_item_get_active (GtkCheckMenuItem *check_menu_item)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item), FALSE);
|
||||
|
||||
return check_menu_item->active;
|
||||
return check_menu_item->priv->active;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -307,13 +322,17 @@ void
|
||||
gtk_check_menu_item_set_inconsistent (GtkCheckMenuItem *check_menu_item,
|
||||
gboolean setting)
|
||||
{
|
||||
GtkCheckMenuItemPriv *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item));
|
||||
|
||||
priv = check_menu_item->priv;
|
||||
|
||||
setting = setting != FALSE;
|
||||
|
||||
if (setting != check_menu_item->inconsistent)
|
||||
if (setting != priv->inconsistent)
|
||||
{
|
||||
check_menu_item->inconsistent = setting;
|
||||
priv->inconsistent = setting;
|
||||
gtk_widget_queue_draw (GTK_WIDGET (check_menu_item));
|
||||
g_object_notify (G_OBJECT (check_menu_item), "inconsistent");
|
||||
}
|
||||
@@ -332,7 +351,7 @@ gtk_check_menu_item_get_inconsistent (GtkCheckMenuItem *check_menu_item)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item), FALSE);
|
||||
|
||||
return check_menu_item->inconsistent;
|
||||
return check_menu_item->priv->inconsistent;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -348,13 +367,17 @@ void
|
||||
gtk_check_menu_item_set_draw_as_radio (GtkCheckMenuItem *check_menu_item,
|
||||
gboolean draw_as_radio)
|
||||
{
|
||||
GtkCheckMenuItemPriv *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item));
|
||||
|
||||
|
||||
priv = check_menu_item->priv;
|
||||
|
||||
draw_as_radio = draw_as_radio != FALSE;
|
||||
|
||||
if (draw_as_radio != check_menu_item->draw_as_radio)
|
||||
if (draw_as_radio != priv->draw_as_radio)
|
||||
{
|
||||
check_menu_item->draw_as_radio = draw_as_radio;
|
||||
priv->draw_as_radio = draw_as_radio;
|
||||
|
||||
gtk_widget_queue_draw (GTK_WIDGET (check_menu_item));
|
||||
|
||||
@@ -377,14 +400,21 @@ gtk_check_menu_item_get_draw_as_radio (GtkCheckMenuItem *check_menu_item)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item), FALSE);
|
||||
|
||||
return check_menu_item->draw_as_radio;
|
||||
return check_menu_item->priv->draw_as_radio;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_check_menu_item_init (GtkCheckMenuItem *check_menu_item)
|
||||
{
|
||||
check_menu_item->active = FALSE;
|
||||
check_menu_item->always_show_toggle = TRUE;
|
||||
GtkCheckMenuItemPriv *priv;
|
||||
|
||||
check_menu_item->priv = G_TYPE_INSTANCE_GET_PRIVATE (check_menu_item,
|
||||
GTK_TYPE_CHECK_MENU_ITEM,
|
||||
GtkCheckMenuItemPriv);
|
||||
priv = check_menu_item->priv;
|
||||
|
||||
priv->active = FALSE;
|
||||
priv->always_show_toggle = TRUE;
|
||||
}
|
||||
|
||||
static gint
|
||||
@@ -402,8 +432,12 @@ gtk_check_menu_item_expose (GtkWidget *widget,
|
||||
static void
|
||||
gtk_check_menu_item_activate (GtkMenuItem *menu_item)
|
||||
{
|
||||
GtkCheckMenuItemPriv *priv;
|
||||
|
||||
GtkCheckMenuItem *check_menu_item = GTK_CHECK_MENU_ITEM (menu_item);
|
||||
check_menu_item->active = !check_menu_item->active;
|
||||
priv = check_menu_item->priv;
|
||||
|
||||
priv->active = !priv->active;
|
||||
|
||||
gtk_check_menu_item_toggled (check_menu_item);
|
||||
gtk_widget_queue_draw (GTK_WIDGET (check_menu_item));
|
||||
@@ -425,6 +459,7 @@ static void
|
||||
gtk_real_check_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item,
|
||||
GdkRectangle *area)
|
||||
{
|
||||
GtkCheckMenuItemPriv *priv = check_menu_item->priv;
|
||||
GtkWidget *widget;
|
||||
GtkStateType state_type;
|
||||
GtkShadowType shadow_type;
|
||||
@@ -434,6 +469,7 @@ gtk_real_check_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item,
|
||||
|
||||
if (gtk_widget_is_drawable (widget))
|
||||
{
|
||||
guint border_width;
|
||||
guint offset;
|
||||
guint toggle_size;
|
||||
guint toggle_spacing;
|
||||
@@ -447,8 +483,8 @@ gtk_real_check_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item,
|
||||
NULL);
|
||||
|
||||
toggle_size = GTK_MENU_ITEM (check_menu_item)->toggle_size;
|
||||
offset = GTK_CONTAINER (check_menu_item)->border_width +
|
||||
widget->style->xthickness + 2;
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||
offset = border_width + widget->style->xthickness + 2;
|
||||
|
||||
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
|
||||
{
|
||||
@@ -464,15 +500,15 @@ gtk_real_check_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item,
|
||||
|
||||
y = widget->allocation.y + (widget->allocation.height - indicator_size) / 2;
|
||||
|
||||
if (check_menu_item->active ||
|
||||
check_menu_item->always_show_toggle ||
|
||||
if (priv->active ||
|
||||
priv->always_show_toggle ||
|
||||
(gtk_widget_get_state (widget) == GTK_STATE_PRELIGHT))
|
||||
{
|
||||
state_type = gtk_widget_get_state (widget);
|
||||
|
||||
if (check_menu_item->inconsistent)
|
||||
if (priv->inconsistent)
|
||||
shadow_type = GTK_SHADOW_ETCHED_IN;
|
||||
else if (check_menu_item->active)
|
||||
else if (priv->active)
|
||||
shadow_type = GTK_SHADOW_IN;
|
||||
else
|
||||
shadow_type = GTK_SHADOW_OUT;
|
||||
@@ -480,7 +516,7 @@ gtk_real_check_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item,
|
||||
if (!gtk_widget_is_sensitive (widget))
|
||||
state_type = GTK_STATE_INSENSITIVE;
|
||||
|
||||
if (check_menu_item->draw_as_radio)
|
||||
if (priv->draw_as_radio)
|
||||
{
|
||||
gtk_paint_option (widget->style, widget->window,
|
||||
state_type, shadow_type,
|
||||
@@ -506,17 +542,18 @@ gtk_check_menu_item_get_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkCheckMenuItem *checkitem = GTK_CHECK_MENU_ITEM (object);
|
||||
GtkCheckMenuItemPriv *priv = checkitem->priv;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_ACTIVE:
|
||||
g_value_set_boolean (value, checkitem->active);
|
||||
g_value_set_boolean (value, priv->active);
|
||||
break;
|
||||
case PROP_INCONSISTENT:
|
||||
g_value_set_boolean (value, checkitem->inconsistent);
|
||||
g_value_set_boolean (value, priv->inconsistent);
|
||||
break;
|
||||
case PROP_DRAW_AS_RADIO:
|
||||
g_value_set_boolean (value, checkitem->draw_as_radio);
|
||||
g_value_set_boolean (value, priv->draw_as_radio);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
|
||||
@@ -46,16 +46,15 @@ G_BEGIN_DECLS
|
||||
|
||||
|
||||
typedef struct _GtkCheckMenuItem GtkCheckMenuItem;
|
||||
typedef struct _GtkCheckMenuItemPriv GtkCheckMenuItemPriv;
|
||||
typedef struct _GtkCheckMenuItemClass GtkCheckMenuItemClass;
|
||||
|
||||
struct _GtkCheckMenuItem
|
||||
{
|
||||
GtkMenuItem menu_item;
|
||||
|
||||
guint GSEAL (active) : 1;
|
||||
guint GSEAL (always_show_toggle) : 1;
|
||||
guint GSEAL (inconsistent) : 1;
|
||||
guint GSEAL (draw_as_radio) : 1;
|
||||
/* <private> */
|
||||
GtkCheckMenuItemPriv *priv;
|
||||
};
|
||||
|
||||
struct _GtkCheckMenuItemClass
|
||||
|
||||
@@ -50,7 +50,6 @@
|
||||
#define CHECK_DARK 21845 /* 65535 / 3 */
|
||||
#define CHECK_LIGHT 43690
|
||||
|
||||
#define GTK_COLOR_BUTTON_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_COLOR_BUTTON, GtkColorButtonPrivate))
|
||||
|
||||
struct _GtkColorButtonPrivate
|
||||
{
|
||||
@@ -528,7 +527,9 @@ gtk_color_button_init (GtkColorButton *color_button)
|
||||
PangoRectangle rect;
|
||||
|
||||
/* Create the widgets */
|
||||
color_button->priv = GTK_COLOR_BUTTON_GET_PRIVATE (color_button);
|
||||
color_button->priv = G_TYPE_INSTANCE_GET_PRIVATE (color_button,
|
||||
GTK_TYPE_COLOR_BUTTON,
|
||||
GtkColorButtonPrivate);
|
||||
|
||||
gtk_widget_push_composite_child ();
|
||||
|
||||
@@ -652,8 +653,10 @@ dialog_ok_clicked (GtkWidget *widget,
|
||||
{
|
||||
GtkColorButton *color_button = GTK_COLOR_BUTTON (data);
|
||||
GtkColorSelection *color_selection;
|
||||
GtkColorSelectionDialog *selection_dialog;
|
||||
|
||||
color_selection = GTK_COLOR_SELECTION (GTK_COLOR_SELECTION_DIALOG (color_button->priv->cs_dialog)->colorsel);
|
||||
selection_dialog = GTK_COLOR_SELECTION_DIALOG (color_button->priv->cs_dialog);
|
||||
color_selection = GTK_COLOR_SELECTION (gtk_color_selection_dialog_get_color_selection (selection_dialog));
|
||||
|
||||
gtk_color_selection_get_current_color (color_selection, &color_button->priv->color);
|
||||
color_button->priv->alpha = gtk_color_selection_get_current_alpha (color_selection);
|
||||
@@ -698,6 +701,7 @@ static void
|
||||
gtk_color_button_clicked (GtkButton *button)
|
||||
{
|
||||
GtkColorButton *color_button = GTK_COLOR_BUTTON (button);
|
||||
GtkColorSelection *color_selection;
|
||||
GtkColorSelectionDialog *color_dialog;
|
||||
|
||||
/* if dialog already exists, make sure it's shown and raised */
|
||||
@@ -705,6 +709,7 @@ gtk_color_button_clicked (GtkButton *button)
|
||||
{
|
||||
/* Create the dialog and connects its buttons */
|
||||
GtkWidget *parent;
|
||||
GtkWidget *ok_button, *cancel_button;
|
||||
|
||||
parent = gtk_widget_get_toplevel (GTK_WIDGET (color_button));
|
||||
|
||||
@@ -720,28 +725,34 @@ gtk_color_button_clicked (GtkButton *button)
|
||||
gtk_window_set_modal (GTK_WINDOW (color_dialog),
|
||||
gtk_window_get_modal (GTK_WINDOW (parent)));
|
||||
}
|
||||
|
||||
g_object_get (color_dialog,
|
||||
"ok-button", &ok_button,
|
||||
"cancel-button", &cancel_button,
|
||||
NULL);
|
||||
|
||||
g_signal_connect (color_dialog->ok_button, "clicked",
|
||||
g_signal_connect (ok_button, "clicked",
|
||||
G_CALLBACK (dialog_ok_clicked), color_button);
|
||||
g_signal_connect (color_dialog->cancel_button, "clicked",
|
||||
g_signal_connect (cancel_button, "clicked",
|
||||
G_CALLBACK (dialog_cancel_clicked), color_button);
|
||||
g_signal_connect (color_dialog, "destroy",
|
||||
G_CALLBACK (dialog_destroy), color_button);
|
||||
}
|
||||
|
||||
color_dialog = GTK_COLOR_SELECTION_DIALOG (color_button->priv->cs_dialog);
|
||||
color_selection = GTK_COLOR_SELECTION (gtk_color_selection_dialog_get_color_selection (color_dialog));
|
||||
|
||||
gtk_color_selection_set_has_opacity_control (GTK_COLOR_SELECTION (color_dialog->colorsel),
|
||||
gtk_color_selection_set_has_opacity_control (color_selection,
|
||||
color_button->priv->use_alpha);
|
||||
|
||||
gtk_color_selection_set_previous_color (GTK_COLOR_SELECTION (color_dialog->colorsel),
|
||||
gtk_color_selection_set_previous_color (color_selection,
|
||||
&color_button->priv->color);
|
||||
gtk_color_selection_set_previous_alpha (GTK_COLOR_SELECTION (color_dialog->colorsel),
|
||||
gtk_color_selection_set_previous_alpha (color_selection,
|
||||
color_button->priv->alpha);
|
||||
|
||||
gtk_color_selection_set_current_color (GTK_COLOR_SELECTION (color_dialog->colorsel),
|
||||
gtk_color_selection_set_current_color (color_selection,
|
||||
&color_button->priv->color);
|
||||
gtk_color_selection_set_current_alpha (GTK_COLOR_SELECTION (color_dialog->colorsel),
|
||||
gtk_color_selection_set_current_alpha (color_selection,
|
||||
color_button->priv->alpha);
|
||||
|
||||
gtk_window_present (GTK_WINDOW (color_button->priv->cs_dialog));
|
||||
|
||||
@@ -63,8 +63,7 @@ struct _GtkColorButton {
|
||||
GtkButton button;
|
||||
|
||||
/*< private >*/
|
||||
|
||||
GtkColorButtonPrivate *GSEAL (priv);
|
||||
GtkColorButtonPrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkColorButtonClass {
|
||||
|
||||
@@ -109,7 +109,6 @@ enum {
|
||||
COLORSEL_NUM_CHANNELS
|
||||
};
|
||||
|
||||
typedef struct _ColorSelectionPrivate ColorSelectionPrivate;
|
||||
|
||||
struct _ColorSelectionPrivate
|
||||
{
|
||||
|
||||
@@ -46,9 +46,9 @@ G_BEGIN_DECLS
|
||||
|
||||
|
||||
typedef struct _GtkColorSelection GtkColorSelection;
|
||||
typedef struct _ColorSelectionPrivate ColorSelectionPrivate;
|
||||
typedef struct _GtkColorSelectionClass GtkColorSelectionClass;
|
||||
|
||||
|
||||
typedef void (* GtkColorSelectionChangePaletteFunc) (const GdkColor *colors,
|
||||
gint n_colors);
|
||||
typedef void (* GtkColorSelectionChangePaletteWithScreenFunc) (GdkScreen *screen,
|
||||
@@ -60,7 +60,7 @@ struct _GtkColorSelection
|
||||
GtkVBox parent_instance;
|
||||
|
||||
/* < private_data > */
|
||||
gpointer GSEAL (private_data);
|
||||
ColorSelectionPrivate *private_data;
|
||||
};
|
||||
|
||||
struct _GtkColorSelectionClass
|
||||
|
||||
@@ -35,6 +35,15 @@
|
||||
#include "gtkbuildable.h"
|
||||
|
||||
|
||||
|
||||
struct _GtkColorSelectionDialogPriv
|
||||
{
|
||||
GtkWidget *colorsel;
|
||||
GtkWidget *ok_button;
|
||||
GtkWidget *cancel_button;
|
||||
GtkWidget *help_button;
|
||||
};
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_COLOR_SELECTION,
|
||||
@@ -66,23 +75,22 @@ gtk_color_selection_dialog_get_property (GObject *object,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkColorSelectionDialog *colorsel;
|
||||
|
||||
colorsel = GTK_COLOR_SELECTION_DIALOG (object);
|
||||
GtkColorSelectionDialog *colorsel = GTK_COLOR_SELECTION_DIALOG (object);
|
||||
GtkColorSelectionDialogPriv *priv = colorsel->priv;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_COLOR_SELECTION:
|
||||
g_value_set_object (value, colorsel->colorsel);
|
||||
g_value_set_object (value, priv->colorsel);
|
||||
break;
|
||||
case PROP_OK_BUTTON:
|
||||
g_value_set_object (value, colorsel->ok_button);
|
||||
g_value_set_object (value, priv->ok_button);
|
||||
break;
|
||||
case PROP_CANCEL_BUTTON:
|
||||
g_value_set_object (value, colorsel->cancel_button);
|
||||
g_value_set_object (value, priv->cancel_button);
|
||||
break;
|
||||
case PROP_HELP_BUTTON:
|
||||
g_value_set_object (value, colorsel->help_button);
|
||||
g_value_set_object (value, priv->help_button);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
@@ -124,43 +132,55 @@ gtk_color_selection_dialog_class_init (GtkColorSelectionDialogClass *klass)
|
||||
P_("The help button of the dialog."),
|
||||
GTK_TYPE_WIDGET,
|
||||
G_PARAM_READABLE));
|
||||
|
||||
g_type_class_add_private (klass, sizeof (GtkColorSelectionDialogPriv));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_color_selection_dialog_init (GtkColorSelectionDialog *colorseldiag)
|
||||
{
|
||||
GtkColorSelectionDialogPriv *priv;
|
||||
GtkDialog *dialog = GTK_DIALOG (colorseldiag);
|
||||
GtkWidget *action_area, *content_area;
|
||||
|
||||
colorseldiag->priv = G_TYPE_INSTANCE_GET_PRIVATE (colorseldiag,
|
||||
GTK_TYPE_COLOR_SELECTION_DIALOG,
|
||||
GtkColorSelectionDialogPriv);
|
||||
priv = colorseldiag->priv;
|
||||
|
||||
content_area = gtk_dialog_get_content_area (dialog);
|
||||
action_area = gtk_dialog_get_action_area (dialog);
|
||||
|
||||
gtk_dialog_set_has_separator (dialog, FALSE);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
|
||||
gtk_box_set_spacing (GTK_BOX (dialog->vbox), 2); /* 2 * 5 + 2 = 12 */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (dialog->action_area), 5);
|
||||
gtk_box_set_spacing (GTK_BOX (dialog->action_area), 6);
|
||||
gtk_box_set_spacing (GTK_BOX (content_area), 2); /* 2 * 5 + 2 = 12 */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (action_area), 5);
|
||||
gtk_box_set_spacing (GTK_BOX (action_area), 6);
|
||||
|
||||
colorseldiag->colorsel = gtk_color_selection_new ();
|
||||
gtk_container_set_border_width (GTK_CONTAINER (colorseldiag->colorsel), 5);
|
||||
gtk_color_selection_set_has_palette (GTK_COLOR_SELECTION(colorseldiag->colorsel), FALSE);
|
||||
gtk_color_selection_set_has_opacity_control (GTK_COLOR_SELECTION(colorseldiag->colorsel), FALSE);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (colorseldiag)->vbox), colorseldiag->colorsel);
|
||||
gtk_widget_show (colorseldiag->colorsel);
|
||||
priv->colorsel = gtk_color_selection_new ();
|
||||
gtk_container_set_border_width (GTK_CONTAINER (priv->colorsel), 5);
|
||||
gtk_color_selection_set_has_palette (GTK_COLOR_SELECTION (priv->colorsel), FALSE);
|
||||
gtk_color_selection_set_has_opacity_control (GTK_COLOR_SELECTION (priv->colorsel), FALSE);
|
||||
gtk_container_add (GTK_CONTAINER (content_area), priv->colorsel);
|
||||
gtk_widget_show (priv->colorsel);
|
||||
|
||||
colorseldiag->cancel_button = gtk_dialog_add_button (GTK_DIALOG (colorseldiag),
|
||||
GTK_STOCK_CANCEL,
|
||||
GTK_RESPONSE_CANCEL);
|
||||
priv->cancel_button = gtk_dialog_add_button (dialog,
|
||||
GTK_STOCK_CANCEL,
|
||||
GTK_RESPONSE_CANCEL);
|
||||
|
||||
colorseldiag->ok_button = gtk_dialog_add_button (GTK_DIALOG (colorseldiag),
|
||||
GTK_STOCK_OK,
|
||||
GTK_RESPONSE_OK);
|
||||
priv->ok_button = gtk_dialog_add_button (dialog,
|
||||
GTK_STOCK_OK,
|
||||
GTK_RESPONSE_OK);
|
||||
|
||||
gtk_widget_grab_default (colorseldiag->ok_button);
|
||||
gtk_widget_grab_default (priv->ok_button);
|
||||
|
||||
colorseldiag->help_button = gtk_dialog_add_button (GTK_DIALOG (colorseldiag),
|
||||
GTK_STOCK_HELP,
|
||||
GTK_RESPONSE_HELP);
|
||||
priv->help_button = gtk_dialog_add_button (dialog,
|
||||
GTK_STOCK_HELP,
|
||||
GTK_RESPONSE_HELP);
|
||||
|
||||
gtk_widget_hide (colorseldiag->help_button);
|
||||
gtk_widget_hide (priv->help_button);
|
||||
|
||||
gtk_dialog_set_alternative_button_order (GTK_DIALOG (colorseldiag),
|
||||
gtk_dialog_set_alternative_button_order (dialog,
|
||||
GTK_RESPONSE_OK,
|
||||
GTK_RESPONSE_CANCEL,
|
||||
GTK_RESPONSE_HELP,
|
||||
@@ -202,7 +222,7 @@ gtk_color_selection_dialog_get_color_selection (GtkColorSelectionDialog *colorse
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_COLOR_SELECTION_DIALOG (colorsel), NULL);
|
||||
|
||||
return colorsel->colorsel;
|
||||
return colorsel->priv->colorsel;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -217,14 +237,17 @@ gtk_color_selection_dialog_buildable_get_internal_child (GtkBuildable *buildable
|
||||
GtkBuilder *builder,
|
||||
const gchar *childname)
|
||||
{
|
||||
if (strcmp(childname, "ok_button") == 0)
|
||||
return G_OBJECT (GTK_COLOR_SELECTION_DIALOG (buildable)->ok_button);
|
||||
else if (strcmp(childname, "cancel_button") == 0)
|
||||
return G_OBJECT (GTK_COLOR_SELECTION_DIALOG (buildable)->cancel_button);
|
||||
else if (strcmp(childname, "help_button") == 0)
|
||||
return G_OBJECT (GTK_COLOR_SELECTION_DIALOG(buildable)->help_button);
|
||||
else if (strcmp(childname, "color_selection") == 0)
|
||||
return G_OBJECT (GTK_COLOR_SELECTION_DIALOG(buildable)->colorsel);
|
||||
GtkColorSelectionDialog *selection_dialog = GTK_COLOR_SELECTION_DIALOG (buildable);
|
||||
GtkColorSelectionDialogPriv *priv = selection_dialog->priv;
|
||||
|
||||
return parent_buildable_iface->get_internal_child (buildable, builder, childname);
|
||||
if (g_strcmp0 (childname, "ok_button") == 0)
|
||||
return G_OBJECT (priv->ok_button);
|
||||
else if (g_strcmp0 (childname, "cancel_button") == 0)
|
||||
return G_OBJECT (priv->cancel_button);
|
||||
else if (g_strcmp0 (childname, "help_button") == 0)
|
||||
return G_OBJECT (priv->help_button);
|
||||
else if (g_strcmp0 (childname, "color_selection") == 0)
|
||||
return G_OBJECT (priv->colorsel);
|
||||
|
||||
return parent_buildable_iface->get_internal_child (buildable, builder, childname);
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ G_BEGIN_DECLS
|
||||
|
||||
|
||||
typedef struct _GtkColorSelectionDialog GtkColorSelectionDialog;
|
||||
typedef struct _GtkColorSelectionDialogPriv GtkColorSelectionDialogPriv;
|
||||
typedef struct _GtkColorSelectionDialogClass GtkColorSelectionDialogClass;
|
||||
|
||||
|
||||
@@ -53,10 +54,8 @@ struct _GtkColorSelectionDialog
|
||||
{
|
||||
GtkDialog parent_instance;
|
||||
|
||||
GtkWidget *GSEAL (colorsel);
|
||||
GtkWidget *GSEAL (ok_button);
|
||||
GtkWidget *GSEAL (cancel_button);
|
||||
GtkWidget *GSEAL (help_button);
|
||||
/* <private> */
|
||||
GtkColorSelectionDialogPriv *priv;
|
||||
};
|
||||
|
||||
struct _GtkColorSelectionDialogClass
|
||||
|
||||
@@ -68,7 +68,6 @@ struct _ComboCellInfo
|
||||
guint pack : 1;
|
||||
};
|
||||
|
||||
#define GTK_COMBO_BOX_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_COMBO_BOX, GtkComboBoxPrivate))
|
||||
|
||||
struct _GtkComboBoxPrivate
|
||||
{
|
||||
@@ -927,11 +926,16 @@ gtk_combo_box_cell_editable_init (GtkCellEditableIface *iface)
|
||||
static void
|
||||
gtk_combo_box_init (GtkComboBox *combo_box)
|
||||
{
|
||||
GtkComboBoxPrivate *priv = GTK_COMBO_BOX_GET_PRIVATE (combo_box);
|
||||
GtkComboBoxPrivate *priv;
|
||||
|
||||
combo_box->priv = G_TYPE_INSTANCE_GET_PRIVATE (combo_box,
|
||||
GTK_TYPE_COMBO_BOX,
|
||||
GtkComboBoxPrivate);
|
||||
priv = combo_box->priv;
|
||||
|
||||
priv->cell_view = gtk_cell_view_new ();
|
||||
gtk_widget_set_parent (priv->cell_view, GTK_WIDGET (combo_box));
|
||||
GTK_BIN (combo_box)->child = priv->cell_view;
|
||||
_gtk_bin_set_child (GTK_BIN (combo_box), priv->cell_view);
|
||||
gtk_widget_show (priv->cell_view);
|
||||
|
||||
priv->width = 0;
|
||||
@@ -952,8 +956,6 @@ gtk_combo_box_init (GtkComboBox *combo_box)
|
||||
priv->focus_on_click = TRUE;
|
||||
priv->button_sensitivity = GTK_SENSITIVITY_AUTO;
|
||||
|
||||
combo_box->priv = priv;
|
||||
|
||||
gtk_combo_box_check_appearance (combo_box);
|
||||
}
|
||||
|
||||
@@ -1033,7 +1035,7 @@ gtk_combo_box_get_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkComboBox *combo_box = GTK_COMBO_BOX (object);
|
||||
GtkComboBoxPrivate *priv = GTK_COMBO_BOX_GET_PRIVATE (combo_box);
|
||||
GtkComboBoxPrivate *priv = combo_box->priv;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
@@ -1180,6 +1182,7 @@ gtk_combo_box_style_set (GtkWidget *widget,
|
||||
{
|
||||
GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
|
||||
GtkComboBoxPrivate *priv = combo_box->priv;
|
||||
GtkWidget *child;
|
||||
|
||||
gtk_combo_box_check_appearance (combo_box);
|
||||
|
||||
@@ -1187,8 +1190,9 @@ gtk_combo_box_style_set (GtkWidget *widget,
|
||||
gtk_cell_view_set_background_color (GTK_CELL_VIEW (priv->cell_view),
|
||||
&widget->style->base[gtk_widget_get_state (widget)]);
|
||||
|
||||
if (GTK_IS_ENTRY (GTK_BIN (combo_box)->child))
|
||||
g_object_set (GTK_BIN (combo_box)->child, "shadow-type",
|
||||
child = gtk_bin_get_child (GTK_BIN (combo_box));
|
||||
if (GTK_IS_ENTRY (child))
|
||||
g_object_set (child, "shadow-type",
|
||||
GTK_SHADOW_NONE == priv->shadow_type ?
|
||||
GTK_SHADOW_IN : GTK_SHADOW_NONE, NULL);
|
||||
}
|
||||
@@ -1218,12 +1222,12 @@ gtk_combo_box_add (GtkContainer *container,
|
||||
if (priv->cell_view && priv->cell_view->parent)
|
||||
{
|
||||
gtk_widget_unparent (priv->cell_view);
|
||||
GTK_BIN (container)->child = NULL;
|
||||
_gtk_bin_set_child (GTK_BIN (container), NULL);
|
||||
gtk_widget_queue_resize (GTK_WIDGET (container));
|
||||
}
|
||||
|
||||
gtk_widget_set_parent (widget, GTK_WIDGET (container));
|
||||
GTK_BIN (container)->child = widget;
|
||||
_gtk_bin_set_child (GTK_BIN (container), widget);
|
||||
|
||||
if (priv->cell_view &&
|
||||
widget != priv->cell_view)
|
||||
@@ -1261,7 +1265,7 @@ gtk_combo_box_remove (GtkContainer *container,
|
||||
priv->cell_view = NULL;
|
||||
|
||||
gtk_widget_unparent (widget);
|
||||
GTK_BIN (container)->child = NULL;
|
||||
_gtk_bin_set_child (GTK_BIN (container), NULL);
|
||||
|
||||
if (GTK_OBJECT_FLAGS (combo_box) & GTK_IN_DESTRUCTION)
|
||||
return;
|
||||
@@ -1286,7 +1290,7 @@ gtk_combo_box_remove (GtkContainer *container,
|
||||
{
|
||||
priv->cell_view = gtk_cell_view_new ();
|
||||
gtk_widget_set_parent (priv->cell_view, GTK_WIDGET (container));
|
||||
GTK_BIN (container)->child = priv->cell_view;
|
||||
_gtk_bin_set_child (GTK_BIN (container), priv->cell_view);
|
||||
|
||||
gtk_widget_show (priv->cell_view);
|
||||
gtk_cell_view_set_model (GTK_CELL_VIEW (priv->cell_view),
|
||||
@@ -1487,7 +1491,7 @@ gtk_combo_box_menu_position_below (GtkMenu *menu,
|
||||
GdkRectangle monitor;
|
||||
|
||||
/* FIXME: is using the size request here broken? */
|
||||
child = GTK_BIN (combo_box)->child;
|
||||
child = gtk_bin_get_child (GTK_BIN (combo_box));
|
||||
|
||||
sx = sy = 0;
|
||||
|
||||
@@ -1789,7 +1793,7 @@ update_menu_sensitivity (GtkComboBox *combo_box,
|
||||
for (child = children; child; child = child->next)
|
||||
{
|
||||
item = GTK_WIDGET (child->data);
|
||||
cell_view = GTK_BIN (item)->child;
|
||||
cell_view = gtk_bin_get_child (GTK_BIN (item));
|
||||
|
||||
if (!GTK_IS_CELL_VIEW (cell_view))
|
||||
continue;
|
||||
@@ -2163,6 +2167,7 @@ gtk_combo_box_size_request (GtkWidget *widget,
|
||||
gint focus_width, focus_pad;
|
||||
gint font_size;
|
||||
gint arrow_size;
|
||||
guint border_width;
|
||||
GtkRequisition bin_req;
|
||||
PangoContext *context;
|
||||
PangoFontMetrics *metrics;
|
||||
@@ -2172,7 +2177,7 @@ gtk_combo_box_size_request (GtkWidget *widget,
|
||||
GtkComboBoxPrivate *priv = combo_box->priv;
|
||||
|
||||
/* common */
|
||||
gtk_widget_size_request (GTK_BIN (widget)->child, &bin_req);
|
||||
gtk_widget_size_request (gtk_bin_get_child (GTK_BIN (widget)), &bin_req);
|
||||
gtk_combo_box_remeasure (combo_box);
|
||||
bin_req.width = MAX (bin_req.width, priv->width);
|
||||
bin_req.height = MAX (bin_req.height, priv->height);
|
||||
@@ -2183,7 +2188,7 @@ gtk_combo_box_size_request (GtkWidget *widget,
|
||||
"arrow-size", &arrow_size,
|
||||
NULL);
|
||||
|
||||
font_desc = GTK_BIN (widget)->child->style->font_desc;
|
||||
font_desc = gtk_bin_get_child (GTK_BIN (widget))->style->font_desc;
|
||||
context = gtk_widget_get_pango_context (widget);
|
||||
metrics = pango_context_get_metrics (context, font_desc,
|
||||
pango_context_get_language (context));
|
||||
@@ -2202,10 +2207,10 @@ gtk_combo_box_size_request (GtkWidget *widget,
|
||||
if (priv->cell_view)
|
||||
{
|
||||
GtkRequisition button_req, sep_req, arrow_req;
|
||||
gint border_width, xthickness, ythickness;
|
||||
gint xthickness, ythickness;
|
||||
|
||||
gtk_widget_size_request (priv->button, &button_req);
|
||||
border_width = GTK_CONTAINER (combo_box)->border_width;
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (combo_box));
|
||||
xthickness = priv->button->style->xthickness;
|
||||
ythickness = priv->button->style->ythickness;
|
||||
|
||||
@@ -2251,12 +2256,10 @@ gtk_combo_box_size_request (GtkWidget *widget,
|
||||
gtk_widget_size_request (priv->cell_view_frame, &frame_req);
|
||||
if (priv->has_frame)
|
||||
{
|
||||
requisition->width += 2 *
|
||||
(GTK_CONTAINER (priv->cell_view_frame)->border_width +
|
||||
GTK_WIDGET (priv->cell_view_frame)->style->xthickness);
|
||||
requisition->height += 2 *
|
||||
(GTK_CONTAINER (priv->cell_view_frame)->border_width +
|
||||
GTK_WIDGET (priv->cell_view_frame)->style->ythickness);
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (priv->cell_view_frame));
|
||||
|
||||
requisition->width += 2 * (border_width + GTK_WIDGET (priv->cell_view_frame)->style->xthickness);
|
||||
requisition->height += 2 * (border_width + GTK_WIDGET (priv->cell_view_frame)->style->ythickness);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2296,6 +2299,7 @@ gtk_combo_box_size_allocate (GtkWidget *widget,
|
||||
{
|
||||
GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
|
||||
GtkComboBoxPrivate *priv = combo_box->priv;
|
||||
GtkWidget *child_widget;
|
||||
gint shadow_width, shadow_height;
|
||||
gint focus_width, focus_pad;
|
||||
GtkAllocation child;
|
||||
@@ -2303,6 +2307,7 @@ gtk_combo_box_size_allocate (GtkWidget *widget,
|
||||
gboolean is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
|
||||
|
||||
widget->allocation = *allocation;
|
||||
child_widget = gtk_bin_get_child (GTK_BIN (widget));
|
||||
|
||||
gtk_widget_style_get (GTK_WIDGET (widget),
|
||||
"focus-line-width", &focus_width,
|
||||
@@ -2324,8 +2329,9 @@ gtk_combo_box_size_allocate (GtkWidget *widget,
|
||||
{
|
||||
if (priv->cell_view)
|
||||
{
|
||||
gint border_width, xthickness, ythickness;
|
||||
gint xthickness, ythickness;
|
||||
gint width;
|
||||
guint border_width;
|
||||
|
||||
/* menu mode */
|
||||
allocation->x += shadow_width;
|
||||
@@ -2336,7 +2342,7 @@ gtk_combo_box_size_allocate (GtkWidget *widget,
|
||||
gtk_widget_size_allocate (priv->button, allocation);
|
||||
|
||||
/* set some things ready */
|
||||
border_width = GTK_CONTAINER (priv->button)->border_width;
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (priv->button));
|
||||
xthickness = priv->button->style->xthickness;
|
||||
ythickness = priv->button->style->ythickness;
|
||||
|
||||
@@ -2406,7 +2412,7 @@ gtk_combo_box_size_allocate (GtkWidget *widget,
|
||||
|
||||
child.width = MAX (1, child.width);
|
||||
child.height = MAX (1, child.height);
|
||||
gtk_widget_size_allocate (GTK_BIN (widget)->child, &child);
|
||||
gtk_widget_size_allocate (child_widget, &child);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2420,7 +2426,7 @@ gtk_combo_box_size_allocate (GtkWidget *widget,
|
||||
child.width = allocation->width - req.width - 2 * shadow_width;
|
||||
child.width = MAX (1, child.width);
|
||||
child.height = MAX (1, child.height);
|
||||
gtk_widget_size_allocate (GTK_BIN (widget)->child, &child);
|
||||
gtk_widget_size_allocate (child_widget, &child);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -2428,8 +2434,9 @@ gtk_combo_box_size_allocate (GtkWidget *widget,
|
||||
/* list mode */
|
||||
|
||||
/* Combobox thickness + border-width */
|
||||
int delta_x = shadow_width + GTK_CONTAINER (widget)->border_width;
|
||||
int delta_y = shadow_height + GTK_CONTAINER (widget)->border_width;
|
||||
guint border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||
int delta_x = shadow_width + border_width;
|
||||
int delta_y = shadow_height + border_width;
|
||||
|
||||
/* button */
|
||||
GTK_COMBO_BOX_SIZE_ALLOCATE_BUTTON
|
||||
@@ -2455,10 +2462,9 @@ gtk_combo_box_size_allocate (GtkWidget *widget,
|
||||
/* the sample */
|
||||
if (priv->has_frame)
|
||||
{
|
||||
delta_x = GTK_CONTAINER (priv->cell_view_frame)->border_width +
|
||||
GTK_WIDGET (priv->cell_view_frame)->style->xthickness;
|
||||
delta_y = GTK_CONTAINER (priv->cell_view_frame)->border_width +
|
||||
GTK_WIDGET (priv->cell_view_frame)->style->ythickness;
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (priv->cell_view_frame));
|
||||
delta_x = border_width + GTK_WIDGET (priv->cell_view_frame)->style->xthickness;
|
||||
delta_y = border_width + GTK_WIDGET (priv->cell_view_frame)->style->ythickness;
|
||||
|
||||
child.x += delta_x;
|
||||
child.y += delta_y;
|
||||
@@ -2486,7 +2492,7 @@ gtk_combo_box_size_allocate (GtkWidget *widget,
|
||||
child.width = MAX (1, child.width);
|
||||
child.height = MAX (1, child.height);
|
||||
|
||||
gtk_widget_size_allocate (GTK_BIN (combo_box)->child, &child);
|
||||
gtk_widget_size_allocate (child_widget, &child);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2541,6 +2547,7 @@ gtk_combo_box_forall (GtkContainer *container,
|
||||
{
|
||||
GtkComboBox *combo_box = GTK_COMBO_BOX (container);
|
||||
GtkComboBoxPrivate *priv = combo_box->priv;
|
||||
GtkWidget *child;
|
||||
|
||||
if (include_internals)
|
||||
{
|
||||
@@ -2550,8 +2557,9 @@ gtk_combo_box_forall (GtkContainer *container,
|
||||
(* callback) (priv->cell_view_frame, callback_data);
|
||||
}
|
||||
|
||||
if (GTK_BIN (container)->child)
|
||||
(* callback) (GTK_BIN (container)->child, callback_data);
|
||||
child = gtk_bin_get_child (GTK_BIN (container));
|
||||
if (child)
|
||||
(* callback) (child, callback_data);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -2601,7 +2609,8 @@ gtk_combo_box_expose_event (GtkWidget *widget,
|
||||
}
|
||||
|
||||
gtk_container_propagate_expose (GTK_CONTAINER (widget),
|
||||
GTK_BIN (widget)->child, event);
|
||||
gtk_bin_get_child (GTK_BIN (widget)),
|
||||
event);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@@ -2881,8 +2890,11 @@ gtk_combo_box_menu_setup (GtkComboBox *combo_box,
|
||||
gboolean add_children)
|
||||
{
|
||||
GtkComboBoxPrivate *priv = combo_box->priv;
|
||||
GtkWidget *child;
|
||||
GtkWidget *menu;
|
||||
|
||||
child = gtk_bin_get_child (GTK_BIN (combo_box));
|
||||
|
||||
if (priv->cell_view)
|
||||
{
|
||||
priv->button = gtk_toggle_button_new ();
|
||||
@@ -2892,7 +2904,7 @@ gtk_combo_box_menu_setup (GtkComboBox *combo_box,
|
||||
g_signal_connect (priv->button, "toggled",
|
||||
G_CALLBACK (gtk_combo_box_button_toggled), combo_box);
|
||||
gtk_widget_set_parent (priv->button,
|
||||
GTK_BIN (combo_box)->child->parent);
|
||||
gtk_widget_get_parent (child));
|
||||
|
||||
priv->box = gtk_hbox_new (FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (priv->button), priv->box);
|
||||
@@ -2914,7 +2926,7 @@ gtk_combo_box_menu_setup (GtkComboBox *combo_box,
|
||||
g_signal_connect (priv->button, "toggled",
|
||||
G_CALLBACK (gtk_combo_box_button_toggled), combo_box);
|
||||
gtk_widget_set_parent (priv->button,
|
||||
GTK_BIN (combo_box)->child->parent);
|
||||
gtk_widget_get_parent (child));
|
||||
|
||||
priv->arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE);
|
||||
gtk_container_add (GTK_CONTAINER (priv->button), priv->arrow);
|
||||
@@ -3257,7 +3269,7 @@ gtk_combo_box_menu_item_activate (GtkWidget *item,
|
||||
GtkTreePath *path;
|
||||
GtkTreeIter iter;
|
||||
|
||||
cell_view = GTK_BIN (item)->child;
|
||||
cell_view = gtk_bin_get_child (GTK_BIN (item));
|
||||
|
||||
g_return_if_fail (GTK_IS_CELL_VIEW (cell_view));
|
||||
|
||||
@@ -3438,6 +3450,7 @@ find_menu_by_path (GtkWidget *menu,
|
||||
gboolean skip_first)
|
||||
{
|
||||
GList *i, *list;
|
||||
GtkWidget *child;
|
||||
GtkWidget *item;
|
||||
GtkWidget *submenu;
|
||||
GtkTreeRowReference *mref;
|
||||
@@ -3449,6 +3462,7 @@ find_menu_by_path (GtkWidget *menu,
|
||||
item = NULL;
|
||||
for (i = list; i; i = i->next)
|
||||
{
|
||||
child = gtk_bin_get_child (i->data);
|
||||
if (GTK_IS_SEPARATOR_MENU_ITEM (i->data))
|
||||
{
|
||||
mref = g_object_get_data (G_OBJECT (i->data), "gtk-combo-box-item-path");
|
||||
@@ -3459,7 +3473,7 @@ find_menu_by_path (GtkWidget *menu,
|
||||
else
|
||||
mpath = gtk_tree_row_reference_get_path (mref);
|
||||
}
|
||||
else if (GTK_IS_CELL_VIEW (GTK_BIN (i->data)->child))
|
||||
else if (GTK_IS_CELL_VIEW (child))
|
||||
{
|
||||
if (skip)
|
||||
{
|
||||
@@ -3467,7 +3481,7 @@ find_menu_by_path (GtkWidget *menu,
|
||||
continue;
|
||||
}
|
||||
|
||||
mpath = gtk_cell_view_get_displayed_row (GTK_CELL_VIEW (GTK_BIN (i->data)->child));
|
||||
mpath = gtk_cell_view_get_displayed_row (GTK_CELL_VIEW (child));
|
||||
}
|
||||
else
|
||||
continue;
|
||||
@@ -3578,7 +3592,7 @@ gtk_combo_box_menu_row_inserted (GtkTreeModel *model,
|
||||
combo_box);
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), separator);
|
||||
if (cell_view_is_sensitive (GTK_CELL_VIEW (GTK_BIN (item)->child)))
|
||||
if (cell_view_is_sensitive (GTK_CELL_VIEW (gtk_bin_get_child (GTK_BIN (item)))))
|
||||
{
|
||||
gtk_widget_show (item);
|
||||
gtk_widget_show (separator);
|
||||
@@ -3745,11 +3759,13 @@ gtk_combo_box_list_setup (GtkComboBox *combo_box)
|
||||
GtkComboBoxPrivate *priv = combo_box->priv;
|
||||
GtkTreeSelection *sel;
|
||||
GtkStyle *style;
|
||||
GtkWidget *child;
|
||||
GtkWidget *widget = GTK_WIDGET (combo_box);
|
||||
|
||||
priv->button = gtk_toggle_button_new ();
|
||||
child = gtk_bin_get_child (GTK_BIN (combo_box));
|
||||
gtk_widget_set_parent (priv->button,
|
||||
GTK_BIN (combo_box)->child->parent);
|
||||
gtk_widget_get_parent (child));
|
||||
g_signal_connect (priv->button, "button-press-event",
|
||||
G_CALLBACK (gtk_combo_box_list_button_pressed), combo_box);
|
||||
g_signal_connect (priv->button, "toggled",
|
||||
@@ -3782,9 +3798,9 @@ gtk_combo_box_list_setup (GtkComboBox *combo_box)
|
||||
gtk_event_box_set_visible_window (GTK_EVENT_BOX (combo_box->priv->cell_view_frame),
|
||||
FALSE);
|
||||
}
|
||||
|
||||
|
||||
gtk_widget_set_parent (priv->cell_view_frame,
|
||||
GTK_BIN (combo_box)->child->parent);
|
||||
gtk_widget_get_parent (child));
|
||||
gtk_container_add (GTK_CONTAINER (priv->cell_view_frame), priv->box);
|
||||
gtk_widget_show_all (priv->cell_view_frame);
|
||||
|
||||
@@ -4260,14 +4276,15 @@ pack_start_recurse (GtkWidget *menu,
|
||||
gboolean expand)
|
||||
{
|
||||
GList *i, *list;
|
||||
GtkWidget *child;
|
||||
GtkWidget *submenu;
|
||||
|
||||
list = gtk_container_get_children (GTK_CONTAINER (menu));
|
||||
for (i = list; i; i = i->next)
|
||||
{
|
||||
if (GTK_IS_CELL_LAYOUT (GTK_BIN (i->data)->child))
|
||||
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (GTK_BIN (i->data)->child),
|
||||
cell, expand);
|
||||
child = gtk_bin_get_child (GTK_BIN (i->data));
|
||||
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (child),
|
||||
cell, expand);
|
||||
|
||||
submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (i->data));
|
||||
if (submenu != NULL)
|
||||
@@ -4314,14 +4331,15 @@ pack_end_recurse (GtkWidget *menu,
|
||||
gboolean expand)
|
||||
{
|
||||
GList *i, *list;
|
||||
GtkWidget *child;
|
||||
GtkWidget *submenu;
|
||||
|
||||
list = gtk_container_get_children (GTK_CONTAINER (menu));
|
||||
for (i = list; i; i = i->next)
|
||||
{
|
||||
if (GTK_IS_CELL_LAYOUT (GTK_BIN (i->data)->child))
|
||||
gtk_cell_layout_pack_end (GTK_CELL_LAYOUT (GTK_BIN (i->data)->child),
|
||||
cell, expand);
|
||||
child = gtk_bin_get_child (GTK_BIN (i->data));
|
||||
gtk_cell_layout_pack_end (GTK_CELL_LAYOUT (child),
|
||||
cell, expand);
|
||||
|
||||
submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (i->data));
|
||||
if (submenu != NULL)
|
||||
@@ -4383,13 +4401,14 @@ static void
|
||||
clear_recurse (GtkWidget *menu)
|
||||
{
|
||||
GList *i, *list;
|
||||
GtkWidget *child;
|
||||
GtkWidget *submenu;
|
||||
|
||||
list = gtk_container_get_children (GTK_CONTAINER (menu));
|
||||
for (i = list; i; i = i->next)
|
||||
{
|
||||
if (GTK_IS_CELL_LAYOUT (GTK_BIN (i->data)->child))
|
||||
gtk_cell_layout_clear (GTK_CELL_LAYOUT (GTK_BIN (i->data)->child));
|
||||
child = gtk_bin_get_child (GTK_BIN (i->data));
|
||||
gtk_cell_layout_clear (GTK_CELL_LAYOUT (child));
|
||||
|
||||
submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (i->data));
|
||||
if (submenu != NULL)
|
||||
@@ -4435,14 +4454,15 @@ add_attribute_recurse (GtkWidget *menu,
|
||||
gint column)
|
||||
{
|
||||
GList *i, *list;
|
||||
GtkWidget *child;
|
||||
GtkWidget *submenu;
|
||||
|
||||
|
||||
list = gtk_container_get_children (GTK_CONTAINER (menu));
|
||||
for (i = list; i; i = i->next)
|
||||
{
|
||||
if (GTK_IS_CELL_LAYOUT (GTK_BIN (i->data)->child))
|
||||
gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (GTK_BIN (i->data)->child),
|
||||
cell, attribute, column);
|
||||
child = gtk_bin_get_child (GTK_BIN (i->data));
|
||||
gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (child),
|
||||
cell, attribute, column);
|
||||
|
||||
submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (i->data));
|
||||
if (submenu != NULL)
|
||||
@@ -4518,7 +4538,7 @@ set_cell_data_func_recurse (GtkWidget *menu,
|
||||
list = gtk_container_get_children (GTK_CONTAINER (menu));
|
||||
for (i = list; i; i = i->next)
|
||||
{
|
||||
cell_view = GTK_BIN (i->data)->child;
|
||||
cell_view = gtk_bin_get_child (GTK_BIN (i->data));
|
||||
if (GTK_IS_CELL_LAYOUT (cell_view))
|
||||
{
|
||||
/* Override sensitivity for inner nodes; we don't
|
||||
@@ -4580,15 +4600,15 @@ clear_attributes_recurse (GtkWidget *menu,
|
||||
GtkCellRenderer *cell)
|
||||
{
|
||||
GList *i, *list;
|
||||
GtkWidget *submenu;
|
||||
|
||||
GtkWidget *submenu;
|
||||
GtkWidget *child;
|
||||
|
||||
list = gtk_container_get_children (GTK_CONTAINER (menu));
|
||||
for (i = list; i; i = i->next)
|
||||
{
|
||||
if (GTK_IS_CELL_LAYOUT (GTK_BIN (i->data)->child))
|
||||
gtk_cell_layout_clear_attributes (GTK_CELL_LAYOUT (GTK_BIN (i->data)->child),
|
||||
cell);
|
||||
|
||||
child = gtk_bin_get_child (GTK_BIN (i->data));
|
||||
gtk_cell_layout_clear_attributes (GTK_CELL_LAYOUT (child), cell);
|
||||
|
||||
submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (i->data));
|
||||
if (submenu != NULL)
|
||||
clear_attributes_recurse (submenu, cell);
|
||||
@@ -4638,15 +4658,16 @@ reorder_recurse (GtkWidget *menu,
|
||||
gint position)
|
||||
{
|
||||
GList *i, *list;
|
||||
GtkWidget *child;
|
||||
GtkWidget *submenu;
|
||||
|
||||
|
||||
list = gtk_container_get_children (GTK_CONTAINER (menu));
|
||||
for (i = list; i; i = i->next)
|
||||
{
|
||||
if (GTK_IS_CELL_LAYOUT (GTK_BIN (i->data)->child))
|
||||
gtk_cell_layout_reorder (GTK_CELL_LAYOUT (GTK_BIN (i->data)->child),
|
||||
cell, position);
|
||||
|
||||
child = gtk_bin_get_child (GTK_BIN (i->data));
|
||||
gtk_cell_layout_reorder (GTK_CELL_LAYOUT (child),
|
||||
cell, position);
|
||||
|
||||
submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (i->data));
|
||||
if (submenu != NULL)
|
||||
reorder_recurse (submenu, cell, position);
|
||||
@@ -5668,6 +5689,7 @@ gtk_combo_box_start_editing (GtkCellEditable *cell_editable,
|
||||
GdkEvent *event)
|
||||
{
|
||||
GtkComboBox *combo_box = GTK_COMBO_BOX (cell_editable);
|
||||
GtkWidget *child;
|
||||
|
||||
combo_box->priv->is_cell_renderer = TRUE;
|
||||
|
||||
@@ -5681,11 +5703,13 @@ gtk_combo_box_start_editing (GtkCellEditable *cell_editable,
|
||||
}
|
||||
else
|
||||
{
|
||||
g_signal_connect_object (GTK_BIN (combo_box)->child, "key-press-event",
|
||||
child = gtk_bin_get_child (GTK_BIN (combo_box));
|
||||
|
||||
g_signal_connect_object (child, "key-press-event",
|
||||
G_CALLBACK (gtk_cell_editable_key_press),
|
||||
cell_editable, 0);
|
||||
|
||||
gtk_widget_grab_focus (GTK_WIDGET (GTK_BIN (combo_box)->child));
|
||||
gtk_widget_grab_focus (child);
|
||||
gtk_widget_set_can_focus (combo_box->priv->button, FALSE);
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ struct _GtkComboBox
|
||||
GtkBin parent_instance;
|
||||
|
||||
/*< private >*/
|
||||
GtkComboBoxPrivate *GSEAL (priv);
|
||||
GtkComboBoxPrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkComboBoxClass
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include "gtkintl.h"
|
||||
#include "gtkbuildable.h"
|
||||
|
||||
#define GTK_COMBO_BOX_ENTRY_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_COMBO_BOX_ENTRY, GtkComboBoxEntryPrivate))
|
||||
|
||||
struct _GtkComboBoxEntryPrivate
|
||||
{
|
||||
@@ -118,7 +117,10 @@ gtk_combo_box_entry_init (GtkComboBoxEntry *entry_box)
|
||||
{
|
||||
GtkWidget *entry;
|
||||
|
||||
entry_box->priv = GTK_COMBO_BOX_ENTRY_GET_PRIVATE (entry_box);
|
||||
entry_box->priv = G_TYPE_INSTANCE_GET_PRIVATE (entry_box,
|
||||
GTK_TYPE_COMBO_BOX_ENTRY,
|
||||
GtkComboBoxEntryPrivate);
|
||||
|
||||
entry_box->priv->text_column = -1;
|
||||
|
||||
entry = gtk_entry_new ();
|
||||
@@ -224,7 +226,10 @@ static void
|
||||
gtk_combo_box_entry_remove (GtkContainer *container,
|
||||
GtkWidget *child)
|
||||
{
|
||||
if (child && child == GTK_BIN (container)->child)
|
||||
GtkWidget *child_widget;
|
||||
|
||||
child_widget = gtk_bin_get_child (GTK_BIN (container));
|
||||
if (child && child == child_widget)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (child,
|
||||
gtk_combo_box_entry_contents_changed,
|
||||
@@ -246,7 +251,7 @@ gtk_combo_box_entry_active_changed (GtkComboBox *combo_box,
|
||||
|
||||
if (gtk_combo_box_get_active_iter (combo_box, &iter))
|
||||
{
|
||||
GtkEntry *entry = GTK_ENTRY (GTK_BIN (combo_box)->child);
|
||||
GtkEntry *entry = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (combo_box)));
|
||||
|
||||
if (entry)
|
||||
{
|
||||
@@ -274,13 +279,16 @@ has_frame_changed (GtkComboBoxEntry *entry_box,
|
||||
GParamSpec *pspec,
|
||||
gpointer data)
|
||||
{
|
||||
if (GTK_BIN (entry_box)->child)
|
||||
GtkWidget *child;
|
||||
|
||||
child = gtk_bin_get_child (GTK_BIN (entry_box));
|
||||
if (child)
|
||||
{
|
||||
gboolean has_frame;
|
||||
|
||||
g_object_get (entry_box, "has-frame", &has_frame, NULL);
|
||||
|
||||
gtk_entry_set_has_frame (GTK_ENTRY (GTK_BIN (entry_box)->child), has_frame);
|
||||
gtk_entry_set_has_frame (GTK_ENTRY (child), has_frame);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -403,9 +411,11 @@ gtk_combo_box_entry_mnemonic_activate (GtkWidget *widget,
|
||||
gboolean group_cycling)
|
||||
{
|
||||
GtkBin *entry_box = GTK_BIN (widget);
|
||||
GtkWidget* child;
|
||||
|
||||
if (entry_box->child)
|
||||
gtk_widget_grab_focus (entry_box->child);
|
||||
child = gtk_bin_get_child (entry_box);
|
||||
if (child)
|
||||
gtk_widget_grab_focus (child);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -414,9 +424,11 @@ static void
|
||||
gtk_combo_box_entry_grab_focus (GtkWidget *widget)
|
||||
{
|
||||
GtkBin *entry_box = GTK_BIN (widget);
|
||||
GtkWidget *child;
|
||||
|
||||
if (entry_box->child)
|
||||
gtk_widget_grab_focus (entry_box->child);
|
||||
child = gtk_bin_get_child (entry_box);
|
||||
if (child)
|
||||
gtk_widget_grab_focus (child);
|
||||
}
|
||||
|
||||
|
||||
@@ -454,9 +466,11 @@ static gchar *
|
||||
gtk_combo_box_entry_get_active_text (GtkComboBox *combo_box)
|
||||
{
|
||||
GtkBin *combo = GTK_BIN (combo_box);
|
||||
GtkWidget *child;
|
||||
|
||||
if (combo->child)
|
||||
return g_strdup (gtk_entry_get_text (GTK_ENTRY (combo->child)));
|
||||
child = gtk_bin_get_child (combo);
|
||||
if (child)
|
||||
return g_strdup (gtk_entry_get_text (GTK_ENTRY (child)));
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ struct _GtkComboBoxEntry
|
||||
GtkComboBox parent_instance;
|
||||
|
||||
/*< private >*/
|
||||
GtkComboBoxEntryPrivate *GSEAL (priv);
|
||||
GtkComboBoxEntryPrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkComboBoxEntryClass
|
||||
|
||||
@@ -41,6 +41,17 @@
|
||||
#include <gobject/gobjectnotifyqueue.c>
|
||||
#include <gobject/gvaluecollector.h>
|
||||
|
||||
struct _GtkContainerPriv
|
||||
{
|
||||
GtkWidget *focus_child;
|
||||
|
||||
guint border_width : 16;
|
||||
|
||||
guint has_focus_chain : 1;
|
||||
guint need_resize : 1;
|
||||
guint reallocate_redraws : 1;
|
||||
guint resize_mode : 2;
|
||||
};
|
||||
|
||||
enum {
|
||||
ADD,
|
||||
@@ -290,6 +301,8 @@ gtk_container_class_init (GtkContainerClass *class)
|
||||
_gtk_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE, 1,
|
||||
GTK_TYPE_WIDGET);
|
||||
|
||||
g_type_class_add_private (class, sizeof (GtkContainerPriv));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1041,17 +1054,25 @@ gtk_container_remove_unimplemented (GtkContainer *container,
|
||||
static void
|
||||
gtk_container_init (GtkContainer *container)
|
||||
{
|
||||
container->focus_child = NULL;
|
||||
container->border_width = 0;
|
||||
container->need_resize = FALSE;
|
||||
container->resize_mode = GTK_RESIZE_PARENT;
|
||||
container->reallocate_redraws = FALSE;
|
||||
GtkContainerPriv *priv;
|
||||
|
||||
container->priv = G_TYPE_INSTANCE_GET_PRIVATE (container,
|
||||
GTK_TYPE_CONTAINER,
|
||||
GtkContainerPriv);
|
||||
priv = container->priv;
|
||||
|
||||
priv->focus_child = NULL;
|
||||
priv->border_width = 0;
|
||||
priv->need_resize = FALSE;
|
||||
priv->resize_mode = GTK_RESIZE_PARENT;
|
||||
priv->reallocate_redraws = FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_container_destroy (GtkObject *object)
|
||||
{
|
||||
GtkContainer *container = GTK_CONTAINER (object);
|
||||
GtkContainerPriv *priv = container->priv;
|
||||
|
||||
if (GTK_CONTAINER_RESIZE_PENDING (container))
|
||||
_gtk_container_dequeue_resize_handler (container);
|
||||
@@ -1059,7 +1080,7 @@ gtk_container_destroy (GtkObject *object)
|
||||
/* do this before walking child widgets, to avoid
|
||||
* removing children from focus chain one by one.
|
||||
*/
|
||||
if (container->has_focus_chain)
|
||||
if (priv->has_focus_chain)
|
||||
gtk_container_unset_focus_chain (container);
|
||||
|
||||
gtk_container_foreach (container, (GtkCallback) gtk_widget_destroy, NULL);
|
||||
@@ -1099,14 +1120,15 @@ gtk_container_get_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkContainer *container = GTK_CONTAINER (object);
|
||||
GtkContainerPriv *priv = container->priv;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_BORDER_WIDTH:
|
||||
g_value_set_uint (value, container->border_width);
|
||||
g_value_set_uint (value, priv->border_width);
|
||||
break;
|
||||
case PROP_RESIZE_MODE:
|
||||
g_value_set_enum (value, container->resize_mode);
|
||||
g_value_set_enum (value, priv->resize_mode);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
@@ -1135,11 +1157,15 @@ void
|
||||
gtk_container_set_border_width (GtkContainer *container,
|
||||
guint border_width)
|
||||
{
|
||||
GtkContainerPriv *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_CONTAINER (container));
|
||||
|
||||
if (container->border_width != border_width)
|
||||
priv = container->priv;
|
||||
|
||||
if (priv->border_width != border_width)
|
||||
{
|
||||
container->border_width = border_width;
|
||||
priv->border_width = border_width;
|
||||
g_object_notify (G_OBJECT (container), "border-width");
|
||||
|
||||
if (gtk_widget_get_realized (GTK_WIDGET (container)))
|
||||
@@ -1161,7 +1187,7 @@ gtk_container_get_border_width (GtkContainer *container)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_CONTAINER (container), 0);
|
||||
|
||||
return container->border_width;
|
||||
return container->priv->border_width;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1257,8 +1283,12 @@ void
|
||||
gtk_container_set_resize_mode (GtkContainer *container,
|
||||
GtkResizeMode resize_mode)
|
||||
{
|
||||
GtkContainerPriv *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_CONTAINER (container));
|
||||
g_return_if_fail (resize_mode <= GTK_RESIZE_IMMEDIATE);
|
||||
|
||||
priv = container->priv;
|
||||
|
||||
if (gtk_widget_is_toplevel (GTK_WIDGET (container)) &&
|
||||
resize_mode == GTK_RESIZE_PARENT)
|
||||
@@ -1266,9 +1296,9 @@ gtk_container_set_resize_mode (GtkContainer *container,
|
||||
resize_mode = GTK_RESIZE_QUEUE;
|
||||
}
|
||||
|
||||
if (container->resize_mode != resize_mode)
|
||||
if (priv->resize_mode != resize_mode)
|
||||
{
|
||||
container->resize_mode = resize_mode;
|
||||
priv->resize_mode = resize_mode;
|
||||
|
||||
gtk_widget_queue_resize (GTK_WIDGET (container));
|
||||
g_object_notify (G_OBJECT (container), "resize-mode");
|
||||
@@ -1289,7 +1319,7 @@ gtk_container_get_resize_mode (GtkContainer *container)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_CONTAINER (container), GTK_RESIZE_PARENT);
|
||||
|
||||
return container->resize_mode;
|
||||
return container->priv->resize_mode;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1308,7 +1338,7 @@ gtk_container_set_reallocate_redraws (GtkContainer *container,
|
||||
{
|
||||
g_return_if_fail (GTK_IS_CONTAINER (container));
|
||||
|
||||
container->reallocate_redraws = needs_redraws ? TRUE : FALSE;
|
||||
container->priv->reallocate_redraws = needs_redraws ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
static GtkContainer*
|
||||
@@ -1357,12 +1387,15 @@ gtk_container_idle_sizer (gpointer data)
|
||||
void
|
||||
_gtk_container_queue_resize (GtkContainer *container)
|
||||
{
|
||||
GtkContainerPriv *priv;
|
||||
GtkContainer *resize_container;
|
||||
GtkWidget *widget;
|
||||
|
||||
g_return_if_fail (GTK_IS_CONTAINER (container));
|
||||
|
||||
priv = container->priv;
|
||||
widget = GTK_WIDGET (container);
|
||||
|
||||
resize_container = gtk_container_get_resize_container (container);
|
||||
|
||||
while (TRUE)
|
||||
@@ -1385,7 +1418,7 @@ _gtk_container_queue_resize (GtkContainer *container)
|
||||
(gtk_widget_is_toplevel (GTK_WIDGET (resize_container)) ||
|
||||
gtk_widget_get_realized (GTK_WIDGET (resize_container))))
|
||||
{
|
||||
switch (resize_container->resize_mode)
|
||||
switch (resize_container->priv->resize_mode)
|
||||
{
|
||||
case GTK_RESIZE_QUEUE:
|
||||
if (!GTK_CONTAINER_RESIZE_PENDING (resize_container))
|
||||
@@ -1414,7 +1447,7 @@ _gtk_container_queue_resize (GtkContainer *container)
|
||||
* changed while they where hidden (currently only evaluated by
|
||||
* toplevels).
|
||||
*/
|
||||
resize_container->need_resize = TRUE;
|
||||
resize_container->priv->need_resize = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1567,7 +1600,7 @@ gtk_container_get_focus_child (GtkContainer *container)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_CONTAINER (container), NULL);
|
||||
|
||||
return container->focus_child;
|
||||
return container->priv->focus_child;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1673,22 +1706,26 @@ static void
|
||||
gtk_container_real_set_focus_child (GtkContainer *container,
|
||||
GtkWidget *child)
|
||||
{
|
||||
GtkContainerPriv *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_CONTAINER (container));
|
||||
g_return_if_fail (child == NULL || GTK_IS_WIDGET (child));
|
||||
|
||||
if (child != container->focus_child)
|
||||
priv = container->priv;
|
||||
|
||||
if (child != priv->focus_child)
|
||||
{
|
||||
if (container->focus_child)
|
||||
g_object_unref (container->focus_child);
|
||||
container->focus_child = child;
|
||||
if (container->focus_child)
|
||||
g_object_ref (container->focus_child);
|
||||
if (priv->focus_child)
|
||||
g_object_unref (priv->focus_child);
|
||||
priv->focus_child = child;
|
||||
if (priv->focus_child)
|
||||
g_object_ref (priv->focus_child);
|
||||
}
|
||||
|
||||
|
||||
/* check for h/v adjustments
|
||||
*/
|
||||
if (container->focus_child)
|
||||
if (priv->focus_child)
|
||||
{
|
||||
GtkAdjustment *hadj;
|
||||
GtkAdjustment *vadj;
|
||||
@@ -1700,18 +1737,17 @@ gtk_container_real_set_focus_child (GtkContainer *container,
|
||||
if (hadj || vadj)
|
||||
{
|
||||
|
||||
focus_child = container->focus_child;
|
||||
while (GTK_IS_CONTAINER (focus_child) &&
|
||||
GTK_CONTAINER (focus_child)->focus_child)
|
||||
focus_child = priv->focus_child;
|
||||
while (gtk_container_get_focus_child (GTK_CONTAINER (focus_child)))
|
||||
{
|
||||
focus_child = GTK_CONTAINER (focus_child)->focus_child;
|
||||
focus_child = gtk_container_get_focus_child (GTK_CONTAINER (focus_child));
|
||||
}
|
||||
|
||||
gtk_widget_translate_coordinates (focus_child, container->focus_child,
|
||||
gtk_widget_translate_coordinates (focus_child, priv->focus_child,
|
||||
0, 0, &x, &y);
|
||||
|
||||
x += container->focus_child->allocation.x;
|
||||
y += container->focus_child->allocation.y;
|
||||
x += priv->focus_child->allocation.x;
|
||||
y += priv->focus_child->allocation.y;
|
||||
|
||||
if (vadj)
|
||||
gtk_adjustment_clamp_page (vadj, y, y + focus_child->allocation.height);
|
||||
@@ -1750,10 +1786,12 @@ gtk_container_focus (GtkWidget *widget,
|
||||
GList *sorted_children;
|
||||
gint return_val;
|
||||
GtkContainer *container;
|
||||
GtkContainerPriv *priv;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_CONTAINER (widget), FALSE);
|
||||
|
||||
container = GTK_CONTAINER (widget);
|
||||
priv = container->priv;
|
||||
|
||||
return_val = FALSE;
|
||||
|
||||
@@ -1770,12 +1808,12 @@ gtk_container_focus (GtkWidget *widget,
|
||||
/* Get a list of the containers children, allowing focus
|
||||
* chain to override.
|
||||
*/
|
||||
if (container->has_focus_chain)
|
||||
if (priv->has_focus_chain)
|
||||
children = g_list_copy (get_focus_chain (container));
|
||||
else
|
||||
children = gtk_container_get_all_children (container);
|
||||
|
||||
if (container->has_focus_chain &&
|
||||
if (priv->has_focus_chain &&
|
||||
(direction == GTK_DIR_TAB_FORWARD ||
|
||||
direction == GTK_DIR_TAB_BACKWARD))
|
||||
{
|
||||
@@ -1871,7 +1909,8 @@ find_old_focus (GtkContainer *container,
|
||||
while (widget && widget != (GtkWidget *)container)
|
||||
{
|
||||
GtkWidget *parent = widget->parent;
|
||||
if (parent && ((GtkContainer *)parent)->focus_child != widget)
|
||||
|
||||
if (parent && (gtk_container_get_focus_child (GTK_CONTAINER (parent)) != widget))
|
||||
goto next;
|
||||
|
||||
widget = parent;
|
||||
@@ -2224,10 +2263,11 @@ gtk_container_focus_move (GtkContainer *container,
|
||||
GList *children,
|
||||
GtkDirectionType direction)
|
||||
{
|
||||
GtkContainerPriv *priv = container->priv;
|
||||
GtkWidget *focus_child;
|
||||
GtkWidget *child;
|
||||
|
||||
focus_child = container->focus_child;
|
||||
focus_child = priv->focus_child;
|
||||
|
||||
while (children)
|
||||
{
|
||||
@@ -2311,13 +2351,16 @@ gtk_container_set_focus_chain (GtkContainer *container,
|
||||
{
|
||||
GList *chain;
|
||||
GList *tmp_list;
|
||||
GtkContainerPriv *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_CONTAINER (container));
|
||||
|
||||
priv = container->priv;
|
||||
|
||||
if (container->has_focus_chain)
|
||||
if (priv->has_focus_chain)
|
||||
gtk_container_unset_focus_chain (container);
|
||||
|
||||
container->has_focus_chain = TRUE;
|
||||
priv->has_focus_chain = TRUE;
|
||||
|
||||
chain = NULL;
|
||||
tmp_list = focusable_widgets;
|
||||
@@ -2372,17 +2415,21 @@ gboolean
|
||||
gtk_container_get_focus_chain (GtkContainer *container,
|
||||
GList **focus_chain)
|
||||
{
|
||||
GtkContainerPriv *priv;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_CONTAINER (container), FALSE);
|
||||
|
||||
priv = container->priv;
|
||||
|
||||
if (focus_chain)
|
||||
{
|
||||
if (container->has_focus_chain)
|
||||
if (priv->has_focus_chain)
|
||||
*focus_chain = g_list_copy (get_focus_chain (container));
|
||||
else
|
||||
*focus_chain = NULL;
|
||||
}
|
||||
|
||||
return container->has_focus_chain;
|
||||
return priv->has_focus_chain;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2393,17 +2440,21 @@ gtk_container_get_focus_chain (GtkContainer *container,
|
||||
**/
|
||||
void
|
||||
gtk_container_unset_focus_chain (GtkContainer *container)
|
||||
{
|
||||
{
|
||||
GtkContainerPriv *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_CONTAINER (container));
|
||||
|
||||
if (container->has_focus_chain)
|
||||
priv = container->priv;
|
||||
|
||||
if (priv->has_focus_chain)
|
||||
{
|
||||
GList *chain;
|
||||
GList *tmp_list;
|
||||
|
||||
chain = get_focus_chain (container);
|
||||
|
||||
container->has_focus_chain = FALSE;
|
||||
priv->has_focus_chain = FALSE;
|
||||
|
||||
g_object_set_data (G_OBJECT (container),
|
||||
I_("gtk-container-focus-chain"),
|
||||
@@ -2683,3 +2734,22 @@ gtk_container_propagate_expose (GtkContainer *container,
|
||||
gdk_event_free (child_event);
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
_gtk_container_get_need_resize (GtkContainer *container)
|
||||
{
|
||||
return container->priv->need_resize;
|
||||
}
|
||||
|
||||
void
|
||||
_gtk_container_set_need_resize (GtkContainer *container,
|
||||
gboolean need_resize)
|
||||
{
|
||||
container->priv->need_resize = need_resize;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_gtk_container_get_reallocate_redraws (GtkContainer *container)
|
||||
{
|
||||
return container->priv->reallocate_redraws;
|
||||
}
|
||||
|
||||
@@ -45,25 +45,17 @@ G_BEGIN_DECLS
|
||||
#define GTK_IS_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CONTAINER))
|
||||
#define GTK_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CONTAINER, GtkContainerClass))
|
||||
|
||||
#define GTK_IS_RESIZE_CONTAINER(widget) (GTK_IS_CONTAINER (widget) && ((GtkContainer*) (widget))->resize_mode != GTK_RESIZE_PARENT)
|
||||
|
||||
|
||||
typedef struct _GtkContainer GtkContainer;
|
||||
typedef struct _GtkContainerPriv GtkContainerPriv;
|
||||
typedef struct _GtkContainerClass GtkContainerClass;
|
||||
|
||||
struct _GtkContainer
|
||||
{
|
||||
GtkWidget widget;
|
||||
|
||||
GtkWidget *GSEAL (focus_child);
|
||||
|
||||
guint GSEAL (border_width) : 16;
|
||||
|
||||
/*< private >*/
|
||||
guint GSEAL (need_resize) : 1;
|
||||
guint GSEAL (resize_mode) : 2;
|
||||
guint GSEAL (reallocate_redraws) : 1;
|
||||
guint GSEAL (has_focus_chain) : 1;
|
||||
GtkContainerPriv *priv;
|
||||
};
|
||||
|
||||
struct _GtkContainerClass
|
||||
@@ -102,6 +94,7 @@ struct _GtkContainerClass
|
||||
void (*_gtk_reserved4) (void);
|
||||
};
|
||||
|
||||
|
||||
/* Application-level methods */
|
||||
|
||||
GType gtk_container_get_type (void) G_GNUC_CONST;
|
||||
@@ -134,6 +127,9 @@ gboolean gtk_container_get_focus_chain (GtkContainer *container,
|
||||
GList **focusable_widgets);
|
||||
void gtk_container_unset_focus_chain (GtkContainer *container);
|
||||
|
||||
#define GTK_IS_RESIZE_CONTAINER(widget) (GTK_IS_CONTAINER (widget) && \
|
||||
(gtk_container_get_resize_mode (GTK_CONTAINER (widget)) != GTK_RESIZE_PARENT))
|
||||
|
||||
/* Widget-level methods */
|
||||
|
||||
void gtk_container_set_reallocate_redraws (GtkContainer *container,
|
||||
@@ -208,7 +204,10 @@ GList *_gtk_container_focus_sort (GtkContainer *container,
|
||||
GList *children,
|
||||
GtkDirectionType direction,
|
||||
GtkWidget *old_focus);
|
||||
|
||||
gboolean _gtk_container_get_need_resize (GtkContainer *container);
|
||||
void _gtk_container_set_need_resize (GtkContainer *container,
|
||||
gboolean need_resize);
|
||||
gboolean _gtk_container_get_reallocate_redraws (GtkContainer *container);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ typedef struct
|
||||
GtkWidget *spin_button;
|
||||
} UnitWidget;
|
||||
|
||||
struct GtkCustomPaperUnixDialogPrivate
|
||||
struct _GtkCustomPaperUnixDialogPrivate
|
||||
{
|
||||
|
||||
GtkWidget *treeview;
|
||||
@@ -86,10 +86,9 @@ enum {
|
||||
PRINTER_LIST_N_COLS
|
||||
};
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GtkCustomPaperUnixDialog, gtk_custom_paper_unix_dialog, GTK_TYPE_DIALOG)
|
||||
|
||||
#define GTK_CUSTOM_PAPER_UNIX_DIALOG_GET_PRIVATE(o) \
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GTK_TYPE_CUSTOM_PAPER_UNIX_DIALOG, GtkCustomPaperUnixDialogPrivate))
|
||||
|
||||
static void gtk_custom_paper_unix_dialog_finalize (GObject *object);
|
||||
static void populate_dialog (GtkCustomPaperUnixDialog *dialog);
|
||||
@@ -272,7 +271,10 @@ gtk_custom_paper_unix_dialog_init (GtkCustomPaperUnixDialog *dialog)
|
||||
GtkCustomPaperUnixDialogPrivate *priv;
|
||||
GtkTreeIter iter;
|
||||
|
||||
priv = dialog->priv = GTK_CUSTOM_PAPER_UNIX_DIALOG_GET_PRIVATE (dialog);
|
||||
dialog->priv = G_TYPE_INSTANCE_GET_PRIVATE (dialog,
|
||||
GTK_TYPE_CUSTOM_PAPER_UNIX_DIALOG,
|
||||
GtkCustomPaperUnixDialogPrivate);
|
||||
priv = dialog->priv;
|
||||
|
||||
priv->print_backends = NULL;
|
||||
|
||||
@@ -961,6 +963,8 @@ static void
|
||||
populate_dialog (GtkCustomPaperUnixDialog *dialog)
|
||||
{
|
||||
GtkCustomPaperUnixDialogPrivate *priv = dialog->priv;
|
||||
GtkDialog *cpu_dialog = GTK_DIALOG (dialog);
|
||||
GtkWidget *action_area, *content_area;
|
||||
GtkWidget *image, *table, *label, *widget, *frame, *combo;
|
||||
GtkWidget *hbox, *vbox, *treeview, *scrolled, *button_box, *button;
|
||||
GtkCellRenderer *cell;
|
||||
@@ -969,15 +973,18 @@ populate_dialog (GtkCustomPaperUnixDialog *dialog)
|
||||
GtkTreeSelection *selection;
|
||||
GtkUnit user_units;
|
||||
|
||||
gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
|
||||
content_area = gtk_dialog_get_content_area (cpu_dialog);
|
||||
action_area = gtk_dialog_get_action_area (cpu_dialog);
|
||||
|
||||
gtk_dialog_set_has_separator (cpu_dialog, FALSE);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
|
||||
gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 2); /* 2 * 5 + 2 = 12 */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 5);
|
||||
gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->action_area), 6);
|
||||
gtk_box_set_spacing (GTK_BOX (content_area), 2); /* 2 * 5 + 2 = 12 */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (action_area), 5);
|
||||
gtk_box_set_spacing (GTK_BOX (action_area), 6);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 18);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (content_area), hbox, TRUE, TRUE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 6);
|
||||
|
||||
@@ -34,13 +34,13 @@ G_BEGIN_DECLS
|
||||
|
||||
typedef struct _GtkCustomPaperUnixDialog GtkCustomPaperUnixDialog;
|
||||
typedef struct _GtkCustomPaperUnixDialogClass GtkCustomPaperUnixDialogClass;
|
||||
typedef struct GtkCustomPaperUnixDialogPrivate GtkCustomPaperUnixDialogPrivate;
|
||||
typedef struct _GtkCustomPaperUnixDialogPrivate GtkCustomPaperUnixDialogPrivate;
|
||||
|
||||
struct _GtkCustomPaperUnixDialog
|
||||
{
|
||||
GtkDialog parent_instance;
|
||||
|
||||
GtkCustomPaperUnixDialogPrivate *GSEAL (priv);
|
||||
GtkCustomPaperUnixDialogPrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkCustomPaperUnixDialogClass
|
||||
|
||||
150
gtk/gtkdialog.c
150
gtk/gtkdialog.c
@@ -41,11 +41,16 @@
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkbuildable.h"
|
||||
|
||||
#define GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_DIALOG, GtkDialogPrivate))
|
||||
|
||||
typedef struct {
|
||||
struct _GtkDialogPriv
|
||||
{
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *action_area;
|
||||
|
||||
GtkWidget *separator;
|
||||
|
||||
guint ignore_separator : 1;
|
||||
} GtkDialogPrivate;
|
||||
};
|
||||
|
||||
typedef struct _ResponseData ResponseData;
|
||||
|
||||
@@ -131,7 +136,7 @@ gtk_dialog_class_init (GtkDialogClass *class)
|
||||
|
||||
class->close = gtk_dialog_close;
|
||||
|
||||
g_type_class_add_private (gobject_class, sizeof (GtkDialogPrivate));
|
||||
g_type_class_add_private (gobject_class, sizeof (GtkDialogPriv));
|
||||
|
||||
/**
|
||||
* GtkDialog:has-separator:
|
||||
@@ -237,6 +242,7 @@ gtk_dialog_class_init (GtkDialogClass *class)
|
||||
static void
|
||||
update_spacings (GtkDialog *dialog)
|
||||
{
|
||||
GtkDialogPriv *priv = dialog->priv;
|
||||
gint content_area_border;
|
||||
gint content_area_spacing;
|
||||
gint button_spacing;
|
||||
@@ -249,25 +255,29 @@ update_spacings (GtkDialog *dialog)
|
||||
"action-area-border", &action_area_border,
|
||||
NULL);
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (dialog->vbox),
|
||||
gtk_container_set_border_width (GTK_CONTAINER (priv->vbox),
|
||||
content_area_border);
|
||||
if (!_gtk_box_get_spacing_set (GTK_BOX (dialog->vbox)))
|
||||
if (!_gtk_box_get_spacing_set (GTK_BOX (priv->vbox)))
|
||||
{
|
||||
gtk_box_set_spacing (GTK_BOX (dialog->vbox), content_area_spacing);
|
||||
_gtk_box_set_spacing_set (GTK_BOX (dialog->vbox), FALSE);
|
||||
gtk_box_set_spacing (GTK_BOX (priv->vbox), content_area_spacing);
|
||||
_gtk_box_set_spacing_set (GTK_BOX (priv->vbox), FALSE);
|
||||
}
|
||||
gtk_box_set_spacing (GTK_BOX (dialog->action_area),
|
||||
gtk_box_set_spacing (GTK_BOX (priv->action_area),
|
||||
button_spacing);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (dialog->action_area),
|
||||
gtk_container_set_border_width (GTK_CONTAINER (priv->action_area),
|
||||
action_area_border);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_dialog_init (GtkDialog *dialog)
|
||||
{
|
||||
GtkDialogPrivate *priv;
|
||||
GtkDialogPriv *priv;
|
||||
|
||||
dialog->priv = G_TYPE_INSTANCE_GET_PRIVATE (dialog,
|
||||
GTK_TYPE_DIALOG,
|
||||
GtkDialogPriv);
|
||||
priv = dialog->priv;
|
||||
|
||||
priv = GET_PRIVATE (dialog);
|
||||
priv->ignore_separator = FALSE;
|
||||
|
||||
/* To avoid breaking old code that prevents destroy on delete event
|
||||
@@ -279,23 +289,23 @@ gtk_dialog_init (GtkDialog *dialog)
|
||||
G_CALLBACK (gtk_dialog_delete_event_handler),
|
||||
NULL);
|
||||
|
||||
dialog->vbox = gtk_vbox_new (FALSE, 0);
|
||||
priv->vbox = gtk_vbox_new (FALSE, 0);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (dialog), dialog->vbox);
|
||||
gtk_widget_show (dialog->vbox);
|
||||
gtk_container_add (GTK_CONTAINER (dialog), priv->vbox);
|
||||
gtk_widget_show (priv->vbox);
|
||||
|
||||
dialog->action_area = gtk_hbutton_box_new ();
|
||||
priv->action_area = gtk_hbutton_box_new ();
|
||||
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog->action_area),
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (priv->action_area),
|
||||
GTK_BUTTONBOX_END);
|
||||
|
||||
gtk_box_pack_end (GTK_BOX (dialog->vbox), dialog->action_area,
|
||||
gtk_box_pack_end (GTK_BOX (priv->vbox), priv->action_area,
|
||||
FALSE, TRUE, 0);
|
||||
gtk_widget_show (dialog->action_area);
|
||||
gtk_widget_show (priv->action_area);
|
||||
|
||||
dialog->separator = gtk_hseparator_new ();
|
||||
gtk_box_pack_end (GTK_BOX (dialog->vbox), dialog->separator, FALSE, TRUE, 0);
|
||||
gtk_widget_show (dialog->separator);
|
||||
priv->separator = gtk_hseparator_new ();
|
||||
gtk_box_pack_end (GTK_BOX (priv->vbox), priv->separator, FALSE, TRUE, 0);
|
||||
gtk_widget_show (priv->separator);
|
||||
|
||||
gtk_window_set_type_hint (GTK_WINDOW (dialog),
|
||||
GDK_WINDOW_TYPE_HINT_DIALOG);
|
||||
@@ -318,14 +328,16 @@ gtk_dialog_buildable_get_internal_child (GtkBuildable *buildable,
|
||||
GtkBuilder *builder,
|
||||
const gchar *childname)
|
||||
{
|
||||
if (strcmp (childname, "vbox") == 0)
|
||||
return G_OBJECT (GTK_DIALOG (buildable)->vbox);
|
||||
else if (strcmp (childname, "action_area") == 0)
|
||||
return G_OBJECT (GTK_DIALOG (buildable)->action_area);
|
||||
GtkDialogPriv *priv = GTK_DIALOG (buildable)->priv;
|
||||
|
||||
return parent_buildable_iface->get_internal_child (buildable,
|
||||
builder,
|
||||
childname);
|
||||
if (strcmp (childname, "vbox") == 0)
|
||||
return G_OBJECT (priv->vbox);
|
||||
else if (strcmp (childname, "action_area") == 0)
|
||||
return G_OBJECT (priv->action_area);
|
||||
|
||||
return parent_buildable_iface->get_internal_child (buildable,
|
||||
builder,
|
||||
childname);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -356,14 +368,13 @@ gtk_dialog_get_property (GObject *object,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkDialog *dialog;
|
||||
|
||||
dialog = GTK_DIALOG (object);
|
||||
GtkDialog *dialog = GTK_DIALOG (object);
|
||||
GtkDialogPriv *priv = dialog->priv;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_HAS_SEPARATOR:
|
||||
g_value_set_boolean (value, dialog->separator != NULL);
|
||||
g_value_set_boolean (value, priv->separator != NULL);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -398,6 +409,7 @@ gtk_dialog_map (GtkWidget *widget)
|
||||
{
|
||||
GtkWindow *window = GTK_WINDOW (widget);
|
||||
GtkDialog *dialog = GTK_DIALOG (widget);
|
||||
GtkDialogPriv *priv = dialog->priv;
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_dialog_parent_class)->map (widget);
|
||||
|
||||
@@ -421,7 +433,7 @@ gtk_dialog_map (GtkWidget *widget)
|
||||
}
|
||||
while (TRUE);
|
||||
|
||||
tmp_list = children = gtk_container_get_children (GTK_CONTAINER (dialog->action_area));
|
||||
tmp_list = children = gtk_container_get_children (GTK_CONTAINER (priv->action_area));
|
||||
|
||||
while (tmp_list)
|
||||
{
|
||||
@@ -454,10 +466,11 @@ static GtkWidget *
|
||||
dialog_find_button (GtkDialog *dialog,
|
||||
gint response_id)
|
||||
{
|
||||
GList *children, *tmp_list;
|
||||
GtkDialogPriv *priv = dialog->priv;
|
||||
GtkWidget *child = NULL;
|
||||
GList *children, *tmp_list;
|
||||
|
||||
children = gtk_container_get_children (GTK_CONTAINER (dialog->action_area));
|
||||
children = gtk_container_get_children (GTK_CONTAINER (priv->action_area));
|
||||
|
||||
for (tmp_list = children; tmp_list; tmp_list = tmp_list->next)
|
||||
{
|
||||
@@ -643,12 +656,15 @@ gtk_dialog_add_action_widget (GtkDialog *dialog,
|
||||
GtkWidget *child,
|
||||
gint response_id)
|
||||
{
|
||||
GtkDialogPriv *priv;
|
||||
ResponseData *ad;
|
||||
guint signal_id;
|
||||
|
||||
g_return_if_fail (GTK_IS_DIALOG (dialog));
|
||||
g_return_if_fail (GTK_IS_WIDGET (child));
|
||||
|
||||
priv = dialog->priv;
|
||||
|
||||
ad = get_response_data (child, TRUE);
|
||||
|
||||
ad->response_id = response_id;
|
||||
@@ -673,12 +689,12 @@ gtk_dialog_add_action_widget (GtkDialog *dialog,
|
||||
else
|
||||
g_warning ("Only 'activatable' widgets can be packed into the action area of a GtkDialog");
|
||||
|
||||
gtk_box_pack_end (GTK_BOX (dialog->action_area),
|
||||
gtk_box_pack_end (GTK_BOX (priv->action_area),
|
||||
child,
|
||||
FALSE, TRUE, 0);
|
||||
|
||||
if (response_id == GTK_RESPONSE_HELP)
|
||||
gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (dialog->action_area), child, TRUE);
|
||||
gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (priv->action_area), child, TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -787,12 +803,15 @@ gtk_dialog_set_response_sensitive (GtkDialog *dialog,
|
||||
gint response_id,
|
||||
gboolean setting)
|
||||
{
|
||||
GtkDialogPriv *priv;
|
||||
GList *children;
|
||||
GList *tmp_list;
|
||||
|
||||
g_return_if_fail (GTK_IS_DIALOG (dialog));
|
||||
|
||||
children = gtk_container_get_children (GTK_CONTAINER (dialog->action_area));
|
||||
priv = dialog->priv;
|
||||
|
||||
children = gtk_container_get_children (GTK_CONTAINER (priv->action_area));
|
||||
|
||||
tmp_list = children;
|
||||
while (tmp_list != NULL)
|
||||
@@ -822,12 +841,15 @@ void
|
||||
gtk_dialog_set_default_response (GtkDialog *dialog,
|
||||
gint response_id)
|
||||
{
|
||||
GtkDialogPriv *priv;
|
||||
GList *children;
|
||||
GList *tmp_list;
|
||||
|
||||
g_return_if_fail (GTK_IS_DIALOG (dialog));
|
||||
|
||||
children = gtk_container_get_children (GTK_CONTAINER (dialog->action_area));
|
||||
priv = dialog->priv;
|
||||
|
||||
children = gtk_container_get_children (GTK_CONTAINER (priv->action_area));
|
||||
|
||||
tmp_list = children;
|
||||
while (tmp_list != NULL)
|
||||
@@ -856,14 +878,14 @@ void
|
||||
gtk_dialog_set_has_separator (GtkDialog *dialog,
|
||||
gboolean setting)
|
||||
{
|
||||
GtkDialogPrivate *priv;
|
||||
GtkDialogPriv *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_DIALOG (dialog));
|
||||
|
||||
priv = GET_PRIVATE (dialog);
|
||||
priv = dialog->priv;
|
||||
|
||||
/* this might fail if we get called before _init() somehow */
|
||||
g_assert (dialog->vbox != NULL);
|
||||
g_assert (priv->vbox != NULL);
|
||||
|
||||
if (priv->ignore_separator)
|
||||
{
|
||||
@@ -871,21 +893,21 @@ gtk_dialog_set_has_separator (GtkDialog *dialog,
|
||||
return;
|
||||
}
|
||||
|
||||
if (setting && dialog->separator == NULL)
|
||||
if (setting && priv->separator == NULL)
|
||||
{
|
||||
dialog->separator = gtk_hseparator_new ();
|
||||
gtk_box_pack_end (GTK_BOX (dialog->vbox), dialog->separator, FALSE, TRUE, 0);
|
||||
priv->separator = gtk_hseparator_new ();
|
||||
gtk_box_pack_end (GTK_BOX (priv->vbox), priv->separator, FALSE, TRUE, 0);
|
||||
|
||||
/* The app programmer could screw this up, but, their own fault.
|
||||
* Moves the separator just above the action area.
|
||||
*/
|
||||
gtk_box_reorder_child (GTK_BOX (dialog->vbox), dialog->separator, 1);
|
||||
gtk_widget_show (dialog->separator);
|
||||
gtk_box_reorder_child (GTK_BOX (priv->vbox), priv->separator, 1);
|
||||
gtk_widget_show (priv->separator);
|
||||
}
|
||||
else if (!setting && dialog->separator != NULL)
|
||||
else if (!setting && priv->separator != NULL)
|
||||
{
|
||||
gtk_widget_destroy (dialog->separator);
|
||||
dialog->separator = NULL;
|
||||
gtk_widget_destroy (priv->separator);
|
||||
priv->separator = NULL;
|
||||
}
|
||||
|
||||
g_object_notify (G_OBJECT (dialog), "has-separator");
|
||||
@@ -904,7 +926,7 @@ gtk_dialog_get_has_separator (GtkDialog *dialog)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_DIALOG (dialog), FALSE);
|
||||
|
||||
return dialog->separator != NULL;
|
||||
return dialog->priv->separator != NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1112,9 +1134,8 @@ void
|
||||
_gtk_dialog_set_ignore_separator (GtkDialog *dialog,
|
||||
gboolean ignore_separator)
|
||||
{
|
||||
GtkDialogPrivate *priv;
|
||||
GtkDialogPriv *priv = dialog->priv;
|
||||
|
||||
priv = GET_PRIVATE (dialog);
|
||||
priv->ignore_separator = ignore_separator;
|
||||
}
|
||||
|
||||
@@ -1134,12 +1155,15 @@ GtkWidget*
|
||||
gtk_dialog_get_widget_for_response (GtkDialog *dialog,
|
||||
gint response_id)
|
||||
{
|
||||
GtkDialogPriv *priv;
|
||||
GList *children;
|
||||
GList *tmp_list;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_DIALOG (dialog), NULL);
|
||||
|
||||
children = gtk_container_get_children (GTK_CONTAINER (dialog->action_area));
|
||||
priv = dialog->priv;
|
||||
|
||||
children = gtk_container_get_children (GTK_CONTAINER (priv->action_area));
|
||||
|
||||
tmp_list = children;
|
||||
while (tmp_list != NULL)
|
||||
@@ -1227,6 +1251,7 @@ gtk_dialog_set_alternative_button_order_valist (GtkDialog *dialog,
|
||||
gint first_response_id,
|
||||
va_list args)
|
||||
{
|
||||
GtkDialogPriv *priv = dialog->priv;
|
||||
GtkWidget *child;
|
||||
gint response_id;
|
||||
gint position;
|
||||
@@ -1237,7 +1262,7 @@ gtk_dialog_set_alternative_button_order_valist (GtkDialog *dialog,
|
||||
{
|
||||
/* reorder child with response_id to position */
|
||||
child = dialog_find_button (dialog, response_id);
|
||||
gtk_box_reorder_child (GTK_BOX (dialog->action_area), child, position);
|
||||
gtk_box_reorder_child (GTK_BOX (priv->action_area), child, position);
|
||||
|
||||
response_id = va_arg (args, gint);
|
||||
position++;
|
||||
@@ -1331,6 +1356,7 @@ gtk_dialog_set_alternative_button_order_from_array (GtkDialog *dialog,
|
||||
gint n_params,
|
||||
gint *new_order)
|
||||
{
|
||||
GtkDialogPriv *priv = dialog->priv;
|
||||
GdkScreen *screen;
|
||||
GtkWidget *child;
|
||||
gint position;
|
||||
@@ -1346,7 +1372,7 @@ gtk_dialog_set_alternative_button_order_from_array (GtkDialog *dialog,
|
||||
{
|
||||
/* reorder child with response_id to position */
|
||||
child = dialog_find_button (dialog, new_order[position]);
|
||||
gtk_box_reorder_child (GTK_BOX (dialog->action_area), child, position);
|
||||
gtk_box_reorder_child (GTK_BOX (priv->action_area), child, position);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1447,10 +1473,11 @@ gtk_dialog_buildable_custom_finished (GtkBuildable *buildable,
|
||||
const gchar *tagname,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkDialog *dialog = GTK_DIALOG (buildable);
|
||||
GtkDialogPriv *priv = dialog->priv;
|
||||
GSList *l;
|
||||
ActionWidgetsSubParserData *parser_data;
|
||||
GObject *object;
|
||||
GtkDialog *dialog;
|
||||
ResponseData *ad;
|
||||
guint signal_id;
|
||||
|
||||
@@ -1461,7 +1488,6 @@ gtk_dialog_buildable_custom_finished (GtkBuildable *buildable,
|
||||
return;
|
||||
}
|
||||
|
||||
dialog = GTK_DIALOG (buildable);
|
||||
parser_data = (ActionWidgetsSubParserData*)user_data;
|
||||
parser_data->items = g_slist_reverse (parser_data->items);
|
||||
|
||||
@@ -1500,7 +1526,7 @@ gtk_dialog_buildable_custom_finished (GtkBuildable *buildable,
|
||||
}
|
||||
|
||||
if (ad->response_id == GTK_RESPONSE_HELP)
|
||||
gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (dialog->action_area),
|
||||
gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (priv->action_area),
|
||||
GTK_WIDGET (object), TRUE);
|
||||
|
||||
g_free (item->widget_name);
|
||||
@@ -1526,7 +1552,7 @@ gtk_dialog_get_action_area (GtkDialog *dialog)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_DIALOG (dialog), NULL);
|
||||
|
||||
return dialog->action_area;
|
||||
return dialog->priv->action_area;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1544,5 +1570,5 @@ gtk_dialog_get_content_area (GtkDialog *dialog)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_DIALOG (dialog), NULL);
|
||||
|
||||
return dialog->vbox;
|
||||
return dialog->priv->vbox;
|
||||
}
|
||||
|
||||
@@ -92,18 +92,15 @@ typedef enum
|
||||
|
||||
|
||||
typedef struct _GtkDialog GtkDialog;
|
||||
typedef struct _GtkDialogPriv GtkDialogPriv;
|
||||
typedef struct _GtkDialogClass GtkDialogClass;
|
||||
|
||||
struct _GtkDialog
|
||||
{
|
||||
GtkWindow window;
|
||||
|
||||
/*< public >*/
|
||||
GtkWidget *GSEAL (vbox);
|
||||
GtkWidget *GSEAL (action_area);
|
||||
|
||||
/*< private >*/
|
||||
GtkWidget *GSEAL (separator);
|
||||
GtkDialogPriv *priv;
|
||||
};
|
||||
|
||||
struct _GtkDialogClass
|
||||
|
||||
@@ -63,7 +63,6 @@ enum
|
||||
PROP_INLINE_SELECTION
|
||||
};
|
||||
|
||||
#define GTK_ENTRY_COMPLETION_GET_PRIVATE(obj)(G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_ENTRY_COMPLETION, GtkEntryCompletionPrivate))
|
||||
|
||||
static void gtk_entry_completion_cell_layout_init (GtkCellLayoutIface *iface);
|
||||
static void gtk_entry_completion_set_property (GObject *object,
|
||||
@@ -422,7 +421,10 @@ gtk_entry_completion_init (GtkEntryCompletion *completion)
|
||||
GtkWidget *popup_frame;
|
||||
|
||||
/* yes, also priv, need to keep the code readable */
|
||||
priv = completion->priv = GTK_ENTRY_COMPLETION_GET_PRIVATE (completion);
|
||||
completion->priv = G_TYPE_INSTANCE_GET_PRIVATE (completion,
|
||||
GTK_TYPE_ENTRY_COMPLETION,
|
||||
GtkEntryCompletionPrivate);
|
||||
priv = completion->priv;
|
||||
|
||||
priv->minimum_key_length = 1;
|
||||
priv->text_column = -1;
|
||||
@@ -469,7 +471,8 @@ gtk_entry_completion_init (GtkEntryCompletion *completion)
|
||||
GTK_SHADOW_NONE);
|
||||
|
||||
/* a nasty hack to get the completions treeview to size nicely */
|
||||
gtk_widget_set_size_request (GTK_SCROLLED_WINDOW (priv->scrolled_window)->vscrollbar, -1, 0);
|
||||
gtk_widget_set_size_request (gtk_scrolled_window_get_vscrollbar (GTK_SCROLLED_WINDOW (priv->scrolled_window)),
|
||||
-1, 0);
|
||||
|
||||
/* actions */
|
||||
priv->actions = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_BOOLEAN);
|
||||
@@ -672,7 +675,7 @@ gtk_entry_completion_pack_start (GtkCellLayout *cell_layout,
|
||||
{
|
||||
GtkEntryCompletionPrivate *priv;
|
||||
|
||||
priv = GTK_ENTRY_COMPLETION_GET_PRIVATE (cell_layout);
|
||||
priv = GTK_ENTRY_COMPLETION (cell_layout)->priv;
|
||||
|
||||
gtk_tree_view_column_pack_start (priv->column, cell, expand);
|
||||
}
|
||||
@@ -684,7 +687,7 @@ gtk_entry_completion_pack_end (GtkCellLayout *cell_layout,
|
||||
{
|
||||
GtkEntryCompletionPrivate *priv;
|
||||
|
||||
priv = GTK_ENTRY_COMPLETION_GET_PRIVATE (cell_layout);
|
||||
priv = GTK_ENTRY_COMPLETION (cell_layout)->priv;
|
||||
|
||||
gtk_tree_view_column_pack_end (priv->column, cell, expand);
|
||||
}
|
||||
@@ -694,7 +697,7 @@ gtk_entry_completion_clear (GtkCellLayout *cell_layout)
|
||||
{
|
||||
GtkEntryCompletionPrivate *priv;
|
||||
|
||||
priv = GTK_ENTRY_COMPLETION_GET_PRIVATE (cell_layout);
|
||||
priv = GTK_ENTRY_COMPLETION (cell_layout)->priv;
|
||||
|
||||
gtk_tree_view_column_clear (priv->column);
|
||||
}
|
||||
@@ -707,7 +710,7 @@ gtk_entry_completion_add_attribute (GtkCellLayout *cell_layout,
|
||||
{
|
||||
GtkEntryCompletionPrivate *priv;
|
||||
|
||||
priv = GTK_ENTRY_COMPLETION_GET_PRIVATE (cell_layout);
|
||||
priv = GTK_ENTRY_COMPLETION (cell_layout)->priv;
|
||||
|
||||
gtk_tree_view_column_add_attribute (priv->column, cell, attribute, column);
|
||||
}
|
||||
@@ -721,7 +724,7 @@ gtk_entry_completion_set_cell_data_func (GtkCellLayout *cell_layout,
|
||||
{
|
||||
GtkEntryCompletionPrivate *priv;
|
||||
|
||||
priv = GTK_ENTRY_COMPLETION_GET_PRIVATE (cell_layout);
|
||||
priv = GTK_ENTRY_COMPLETION (cell_layout)->priv;
|
||||
|
||||
gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (priv->column),
|
||||
cell, func, func_data, destroy);
|
||||
@@ -733,7 +736,7 @@ gtk_entry_completion_clear_attributes (GtkCellLayout *cell_layout,
|
||||
{
|
||||
GtkEntryCompletionPrivate *priv;
|
||||
|
||||
priv = GTK_ENTRY_COMPLETION_GET_PRIVATE (cell_layout);
|
||||
priv = GTK_ENTRY_COMPLETION (cell_layout)->priv;
|
||||
|
||||
gtk_tree_view_column_clear_attributes (priv->column, cell);
|
||||
}
|
||||
@@ -745,7 +748,7 @@ gtk_entry_completion_reorder (GtkCellLayout *cell_layout,
|
||||
{
|
||||
GtkEntryCompletionPrivate *priv;
|
||||
|
||||
priv = GTK_ENTRY_COMPLETION_GET_PRIVATE (cell_layout);
|
||||
priv = GTK_ENTRY_COMPLETION (cell_layout)->priv;
|
||||
|
||||
gtk_cell_layout_reorder (GTK_CELL_LAYOUT (priv->column), cell, position);
|
||||
}
|
||||
@@ -755,7 +758,7 @@ gtk_entry_completion_get_cells (GtkCellLayout *cell_layout)
|
||||
{
|
||||
GtkEntryCompletionPrivate *priv;
|
||||
|
||||
priv = GTK_ENTRY_COMPLETION_GET_PRIVATE (cell_layout);
|
||||
priv = GTK_ENTRY_COMPLETION (cell_layout)->priv;
|
||||
|
||||
return gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (priv->column));
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ struct _GtkEntryCompletion
|
||||
GObject parent_instance;
|
||||
|
||||
/*< private >*/
|
||||
GtkEntryCompletionPrivate *GSEAL (priv);
|
||||
GtkEntryCompletionPrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkEntryCompletionClass
|
||||
|
||||
@@ -374,7 +374,7 @@ gtk_event_box_realize (GtkWidget *widget)
|
||||
|
||||
gtk_widget_set_realized (widget, TRUE);
|
||||
|
||||
border_width = GTK_CONTAINER (widget)->border_width;
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||
|
||||
attributes.x = widget->allocation.x + border_width;
|
||||
attributes.y = widget->allocation.y + border_width;
|
||||
@@ -483,15 +483,19 @@ gtk_event_box_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition)
|
||||
{
|
||||
GtkBin *bin = GTK_BIN (widget);
|
||||
guint border_width;
|
||||
GtkWidget *child;
|
||||
|
||||
requisition->width = GTK_CONTAINER (widget)->border_width * 2;
|
||||
requisition->height = GTK_CONTAINER (widget)->border_width * 2;
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||
requisition->width = border_width * 2;
|
||||
requisition->height = border_width * 2;
|
||||
|
||||
if (bin->child && gtk_widget_get_visible (bin->child))
|
||||
child = gtk_bin_get_child (bin);
|
||||
if (child && gtk_widget_get_visible (child))
|
||||
{
|
||||
GtkRequisition child_requisition;
|
||||
|
||||
gtk_widget_size_request (bin->child, &child_requisition);
|
||||
gtk_widget_size_request (child, &child_requisition);
|
||||
|
||||
requisition->width += child_requisition.width;
|
||||
requisition->height += child_requisition.height;
|
||||
@@ -505,22 +509,25 @@ gtk_event_box_size_allocate (GtkWidget *widget,
|
||||
GtkBin *bin;
|
||||
GtkAllocation child_allocation;
|
||||
GtkEventBoxPrivate *priv;
|
||||
|
||||
guint border_width;
|
||||
GtkWidget *child;
|
||||
|
||||
widget->allocation = *allocation;
|
||||
bin = GTK_BIN (widget);
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||
|
||||
if (!gtk_widget_get_has_window (widget))
|
||||
{
|
||||
child_allocation.x = allocation->x + GTK_CONTAINER (widget)->border_width;
|
||||
child_allocation.y = allocation->y + GTK_CONTAINER (widget)->border_width;
|
||||
child_allocation.x = allocation->x + border_width;
|
||||
child_allocation.y = allocation->y + border_width;
|
||||
}
|
||||
else
|
||||
{
|
||||
child_allocation.x = 0;
|
||||
child_allocation.y = 0;
|
||||
}
|
||||
child_allocation.width = MAX (allocation->width - GTK_CONTAINER (widget)->border_width * 2, 0);
|
||||
child_allocation.height = MAX (allocation->height - GTK_CONTAINER (widget)->border_width * 2, 0);
|
||||
child_allocation.width = MAX (allocation->width - border_width * 2, 0);
|
||||
child_allocation.height = MAX (allocation->height - border_width * 2, 0);
|
||||
|
||||
if (gtk_widget_get_realized (widget))
|
||||
{
|
||||
@@ -535,14 +542,15 @@ gtk_event_box_size_allocate (GtkWidget *widget,
|
||||
|
||||
if (gtk_widget_get_has_window (widget))
|
||||
gdk_window_move_resize (widget->window,
|
||||
allocation->x + GTK_CONTAINER (widget)->border_width,
|
||||
allocation->y + GTK_CONTAINER (widget)->border_width,
|
||||
allocation->x + border_width,
|
||||
allocation->y + border_width,
|
||||
child_allocation.width,
|
||||
child_allocation.height);
|
||||
}
|
||||
|
||||
if (bin->child)
|
||||
gtk_widget_size_allocate (bin->child, &child_allocation);
|
||||
|
||||
child = gtk_bin_get_child (bin);
|
||||
if (child)
|
||||
gtk_widget_size_allocate (child, &child_allocation);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#include "gtkdnd.h"
|
||||
|
||||
#define GTK_EXPANDER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GTK_TYPE_EXPANDER, GtkExpanderPrivate))
|
||||
|
||||
#define DEFAULT_EXPANDER_SIZE 10
|
||||
#define DEFAULT_EXPANDER_SPACING 2
|
||||
@@ -263,7 +262,9 @@ gtk_expander_init (GtkExpander *expander)
|
||||
{
|
||||
GtkExpanderPrivate *priv;
|
||||
|
||||
expander->priv = priv = GTK_EXPANDER_GET_PRIVATE (expander);
|
||||
expander->priv = priv = G_TYPE_INSTANCE_GET_PRIVATE (expander,
|
||||
GTK_TYPE_EXPANDER,
|
||||
GtkExpanderPrivate);
|
||||
|
||||
gtk_widget_set_can_focus (GTK_WIDGET (expander), TRUE);
|
||||
gtk_widget_set_has_window (GTK_WIDGET (expander), FALSE);
|
||||
@@ -404,7 +405,7 @@ gtk_expander_realize (GtkWidget *widget)
|
||||
priv = GTK_EXPANDER (widget)->priv;
|
||||
gtk_widget_set_realized (widget, TRUE);
|
||||
|
||||
border_width = GTK_CONTAINER (widget)->border_width;
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||
|
||||
get_expander_bounds (GTK_EXPANDER (widget), &expander_rect);
|
||||
|
||||
@@ -464,6 +465,7 @@ gtk_expander_size_request (GtkWidget *widget,
|
||||
GtkExpander *expander;
|
||||
GtkBin *bin;
|
||||
GtkExpanderPrivate *priv;
|
||||
GtkWidget *child;
|
||||
gint border_width;
|
||||
gint expander_size;
|
||||
gint expander_spacing;
|
||||
@@ -475,7 +477,7 @@ gtk_expander_size_request (GtkWidget *widget,
|
||||
expander = GTK_EXPANDER (widget);
|
||||
priv = expander->priv;
|
||||
|
||||
border_width = GTK_CONTAINER (widget)->border_width;
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||
|
||||
gtk_widget_style_get (widget,
|
||||
"interior-focus", &interior_focus,
|
||||
@@ -504,11 +506,12 @@ gtk_expander_size_request (GtkWidget *widget,
|
||||
if (!interior_focus)
|
||||
requisition->height += 2 * focus_width + 2 * focus_pad;
|
||||
|
||||
if (bin->child && GTK_WIDGET_CHILD_VISIBLE (bin->child))
|
||||
child = gtk_bin_get_child (bin);
|
||||
if (child && GTK_WIDGET_CHILD_VISIBLE (child))
|
||||
{
|
||||
GtkRequisition child_requisition;
|
||||
|
||||
gtk_widget_size_request (bin->child, &child_requisition);
|
||||
gtk_widget_size_request (child, &child_requisition);
|
||||
|
||||
requisition->width = MAX (requisition->width, child_requisition.width);
|
||||
requisition->height += child_requisition.height + priv->spacing;
|
||||
@@ -535,7 +538,7 @@ get_expander_bounds (GtkExpander *expander,
|
||||
widget = GTK_WIDGET (expander);
|
||||
priv = expander->priv;
|
||||
|
||||
border_width = GTK_CONTAINER (expander)->border_width;
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||
|
||||
gtk_widget_style_get (widget,
|
||||
"interior-focus", &interior_focus,
|
||||
@@ -592,8 +595,9 @@ gtk_expander_size_allocate (GtkWidget *widget,
|
||||
GtkBin *bin;
|
||||
GtkExpanderPrivate *priv;
|
||||
GtkRequisition child_requisition;
|
||||
GtkWidget *child;
|
||||
gboolean child_visible = FALSE;
|
||||
gint border_width;
|
||||
guint border_width;
|
||||
gint expander_size;
|
||||
gint expander_spacing;
|
||||
gboolean interior_focus;
|
||||
@@ -605,7 +609,7 @@ gtk_expander_size_allocate (GtkWidget *widget,
|
||||
bin = GTK_BIN (widget);
|
||||
priv = expander->priv;
|
||||
|
||||
border_width = GTK_CONTAINER (widget)->border_width;
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||
|
||||
gtk_widget_style_get (widget,
|
||||
"interior-focus", &interior_focus,
|
||||
@@ -617,10 +621,12 @@ gtk_expander_size_allocate (GtkWidget *widget,
|
||||
|
||||
child_requisition.width = 0;
|
||||
child_requisition.height = 0;
|
||||
if (bin->child && GTK_WIDGET_CHILD_VISIBLE (bin->child))
|
||||
|
||||
child = gtk_bin_get_child (bin);
|
||||
if (child && GTK_WIDGET_CHILD_VISIBLE (child))
|
||||
{
|
||||
child_visible = TRUE;
|
||||
gtk_widget_get_child_requisition (bin->child, &child_requisition);
|
||||
gtk_widget_get_child_requisition (child, &child_requisition);
|
||||
}
|
||||
|
||||
widget->allocation = *allocation;
|
||||
@@ -703,7 +709,7 @@ gtk_expander_size_allocate (GtkWidget *widget,
|
||||
(!interior_focus ? 2 * focus_width + 2 * focus_pad : 0);
|
||||
child_allocation.height = MAX (child_allocation.height, 1);
|
||||
|
||||
gtk_widget_size_allocate (bin->child, &child_allocation);
|
||||
gtk_widget_size_allocate (child, &child_allocation);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -747,6 +753,7 @@ gtk_expander_paint_prelight (GtkExpander *expander)
|
||||
int focus_pad;
|
||||
int expander_size;
|
||||
int expander_spacing;
|
||||
guint border_width;
|
||||
|
||||
priv = expander->priv;
|
||||
widget = GTK_WIDGET (expander);
|
||||
@@ -760,9 +767,10 @@ gtk_expander_paint_prelight (GtkExpander *expander)
|
||||
"expander-spacing", &expander_spacing,
|
||||
NULL);
|
||||
|
||||
area.x = widget->allocation.x + container->border_width;
|
||||
area.y = widget->allocation.y + container->border_width;
|
||||
area.width = widget->allocation.width - (2 * container->border_width);
|
||||
border_width = gtk_container_get_border_width (container);
|
||||
area.x = widget->allocation.x + border_width;
|
||||
area.y = widget->allocation.y + border_width;
|
||||
area.width = widget->allocation.width - (2 * border_width);
|
||||
|
||||
if (priv->label_widget && gtk_widget_get_visible (priv->label_widget))
|
||||
area.height = priv->label_widget->allocation.height;
|
||||
@@ -830,7 +838,7 @@ gtk_expander_paint_focus (GtkExpander *expander,
|
||||
widget = GTK_WIDGET (expander);
|
||||
priv = expander->priv;
|
||||
|
||||
border_width = GTK_CONTAINER (widget)->border_width;
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||
|
||||
gtk_widget_style_get (widget,
|
||||
"interior-focus", &interior_focus,
|
||||
@@ -1080,7 +1088,7 @@ focus_current_site (GtkExpander *expander,
|
||||
{
|
||||
GtkWidget *current_focus;
|
||||
|
||||
current_focus = GTK_CONTAINER (expander)->focus_child;
|
||||
current_focus = gtk_container_get_focus_child (GTK_CONTAINER (expander));
|
||||
|
||||
if (!current_focus)
|
||||
return FALSE;
|
||||
@@ -1204,7 +1212,7 @@ gtk_expander_focus (GtkWidget *widget,
|
||||
FocusSite site = FOCUS_NONE;
|
||||
|
||||
widget_is_focus = gtk_widget_is_focus (widget);
|
||||
old_focus_child = GTK_CONTAINER (widget)->focus_child;
|
||||
old_focus_child = gtk_container_get_focus_child (GTK_CONTAINER (widget));
|
||||
|
||||
if (old_focus_child && old_focus_child == expander->priv->label_widget)
|
||||
site = FOCUS_LABEL;
|
||||
@@ -1255,9 +1263,11 @@ gtk_expander_forall (GtkContainer *container,
|
||||
{
|
||||
GtkBin *bin = GTK_BIN (container);
|
||||
GtkExpanderPrivate *priv = GTK_EXPANDER (container)->priv;
|
||||
GtkWidget *child;
|
||||
|
||||
if (bin->child)
|
||||
(* callback) (bin->child, callback_data);
|
||||
child = gtk_bin_get_child (bin);
|
||||
if (child)
|
||||
(* callback) (child, callback_data);
|
||||
|
||||
if (priv->label_widget)
|
||||
(* callback) (priv->label_widget, callback_data);
|
||||
@@ -1314,6 +1324,7 @@ static gboolean
|
||||
gtk_expander_animation_timeout (GtkExpander *expander)
|
||||
{
|
||||
GtkExpanderPrivate *priv = expander->priv;
|
||||
GtkWidget *child;
|
||||
GdkRectangle area;
|
||||
gboolean finish = FALSE;
|
||||
|
||||
@@ -1351,8 +1362,10 @@ gtk_expander_animation_timeout (GtkExpander *expander)
|
||||
if (finish)
|
||||
{
|
||||
priv->animation_timeout = 0;
|
||||
if (GTK_BIN (expander)->child)
|
||||
gtk_widget_set_child_visible (GTK_BIN (expander)->child, priv->expanded);
|
||||
|
||||
child = gtk_bin_get_child (GTK_BIN (expander));
|
||||
if (child)
|
||||
gtk_widget_set_child_visible (child, priv->expanded);
|
||||
gtk_widget_queue_resize (GTK_WIDGET (expander));
|
||||
}
|
||||
|
||||
@@ -1389,6 +1402,7 @@ gtk_expander_set_expanded (GtkExpander *expander,
|
||||
gboolean expanded)
|
||||
{
|
||||
GtkExpanderPrivate *priv;
|
||||
GtkWidget *child;
|
||||
|
||||
g_return_if_fail (GTK_IS_EXPANDER (expander));
|
||||
|
||||
@@ -1414,9 +1428,10 @@ gtk_expander_set_expanded (GtkExpander *expander,
|
||||
priv->expander_style = expanded ? GTK_EXPANDER_EXPANDED :
|
||||
GTK_EXPANDER_COLLAPSED;
|
||||
|
||||
if (GTK_BIN (expander)->child)
|
||||
child = gtk_bin_get_child (GTK_BIN (expander));
|
||||
if (child)
|
||||
{
|
||||
gtk_widget_set_child_visible (GTK_BIN (expander)->child, priv->expanded);
|
||||
gtk_widget_set_child_visible (child, priv->expanded);
|
||||
gtk_widget_queue_resize (GTK_WIDGET (expander));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ struct _GtkExpander
|
||||
{
|
||||
GtkBin bin;
|
||||
|
||||
GtkExpanderPrivate *GSEAL (priv);
|
||||
GtkExpanderPrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkExpanderClass
|
||||
|
||||
@@ -58,8 +58,6 @@
|
||||
* Private Macros *
|
||||
* **************** */
|
||||
|
||||
#define GTK_FILE_CHOOSER_BUTTON_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GTK_TYPE_FILE_CHOOSER_BUTTON, GtkFileChooserButtonPrivate))
|
||||
|
||||
#define DEFAULT_TITLE N_("Select A File")
|
||||
#define DESKTOP_DISPLAY_NAME N_("Desktop")
|
||||
#define FALLBACK_DISPLAY_NAME N_("(None)")
|
||||
@@ -434,7 +432,9 @@ gtk_file_chooser_button_init (GtkFileChooserButton *button)
|
||||
GtkWidget *box, *image, *sep;
|
||||
GtkTargetList *target_list;
|
||||
|
||||
priv = button->priv = GTK_FILE_CHOOSER_BUTTON_GET_PRIVATE (button);
|
||||
priv = button->priv = G_TYPE_INSTANCE_GET_PRIVATE (button,
|
||||
GTK_TYPE_FILE_CHOOSER_BUTTON,
|
||||
GtkFileChooserButtonPrivate);
|
||||
|
||||
priv->icon_size = FALLBACK_ICON_SIZE;
|
||||
priv->focus_on_click = TRUE;
|
||||
|
||||
@@ -43,10 +43,10 @@ typedef struct _GtkFileChooserButtonClass GtkFileChooserButtonClass;
|
||||
|
||||
struct _GtkFileChooserButton
|
||||
{
|
||||
/*< private >*/
|
||||
GtkHBox parent;
|
||||
|
||||
GtkFileChooserButtonPrivate *GSEAL (priv);
|
||||
/*< private >*/
|
||||
GtkFileChooserButtonPrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkFileChooserButtonClass
|
||||
|
||||
@@ -4408,9 +4408,12 @@ file_list_query_tooltip_cb (GtkWidget *widget,
|
||||
static void
|
||||
set_icon_cell_renderer_fixed_size (GtkFileChooserDefault *impl, GtkCellRenderer *renderer)
|
||||
{
|
||||
gint xpad, ypad;
|
||||
|
||||
gtk_cell_renderer_get_padding (renderer, &xpad, &ypad);
|
||||
gtk_cell_renderer_set_fixed_size (renderer,
|
||||
renderer->xpad * 2 + impl->icon_size,
|
||||
renderer->ypad * 2 + impl->icon_size);
|
||||
xpad * 2 + impl->icon_size,
|
||||
ypad * 2 + impl->icon_size);
|
||||
}
|
||||
|
||||
/* Creates the widgets for the file list */
|
||||
@@ -8026,7 +8029,7 @@ gtk_file_chooser_default_get_default_size (GtkFileChooserEmbed *chooser_embed,
|
||||
gtk_widget_get_visible (impl->extra_widget))
|
||||
{
|
||||
gtk_widget_size_request (impl->extra_align, &req);
|
||||
*default_height += GTK_BOX (chooser_embed)->spacing + req.height;
|
||||
*default_height += gtk_box_get_spacing (GTK_BOX (chooser_embed)) + req.height;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -80,6 +80,7 @@ gtk_file_chooser_dialog_class_init (GtkFileChooserDialogClass *class)
|
||||
static void
|
||||
gtk_file_chooser_dialog_init (GtkFileChooserDialog *dialog)
|
||||
{
|
||||
GtkWidget *action_area, *content_area;
|
||||
GtkFileChooserDialogPrivate *priv = G_TYPE_INSTANCE_GET_PRIVATE (dialog,
|
||||
GTK_TYPE_FILE_CHOOSER_DIALOG,
|
||||
GtkFileChooserDialogPrivate);
|
||||
@@ -88,10 +89,13 @@ gtk_file_chooser_dialog_init (GtkFileChooserDialog *dialog)
|
||||
dialog->priv = priv;
|
||||
dialog->priv->response_requested = FALSE;
|
||||
|
||||
content_area = gtk_dialog_get_content_area (fc_dialog);
|
||||
action_area = gtk_dialog_get_action_area (fc_dialog);
|
||||
|
||||
gtk_dialog_set_has_separator (fc_dialog, FALSE);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (fc_dialog), 5);
|
||||
gtk_box_set_spacing (GTK_BOX (fc_dialog->vbox), 2); /* 2 * 5 + 2 = 12 */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (fc_dialog->action_area), 5);
|
||||
gtk_box_set_spacing (GTK_BOX (content_area), 2); /* 2 * 5 + 2 = 12 */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (action_area), 5);
|
||||
|
||||
/* We do a signal connection here rather than overriding the method in
|
||||
* class_init because GtkDialog::response is a RUN_LAST signal. We want *our*
|
||||
@@ -126,6 +130,8 @@ static void
|
||||
file_chooser_widget_file_activated (GtkFileChooser *chooser,
|
||||
GtkFileChooserDialog *dialog)
|
||||
{
|
||||
GtkDialog *fc_dialog = GTK_DIALOG (dialog);
|
||||
GtkWidget *action_area;
|
||||
GList *children, *l;
|
||||
|
||||
if (gtk_window_activate_default (GTK_WINDOW (dialog)))
|
||||
@@ -134,8 +140,8 @@ file_chooser_widget_file_activated (GtkFileChooser *chooser,
|
||||
/* There probably isn't a default widget, so make things easier for the
|
||||
* programmer by looking for a reasonable button on our own.
|
||||
*/
|
||||
|
||||
children = gtk_container_get_children (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area));
|
||||
action_area = gtk_dialog_get_action_area (fc_dialog);
|
||||
children = gtk_container_get_children (GTK_CONTAINER (action_area));
|
||||
|
||||
for (l = children; l; l = l->next)
|
||||
{
|
||||
@@ -143,7 +149,7 @@ file_chooser_widget_file_activated (GtkFileChooser *chooser,
|
||||
int response_id;
|
||||
|
||||
widget = GTK_WIDGET (l->data);
|
||||
response_id = gtk_dialog_get_response_for_widget (GTK_DIALOG (dialog), widget);
|
||||
response_id = gtk_dialog_get_response_for_widget (fc_dialog, widget);
|
||||
if (is_stock_accept_response_id (response_id))
|
||||
{
|
||||
gtk_widget_activate (widget); /* Should we gtk_dialog_response (dialog, response_id) instead? */
|
||||
@@ -221,6 +227,8 @@ static void
|
||||
file_chooser_widget_response_requested (GtkWidget *widget,
|
||||
GtkFileChooserDialog *dialog)
|
||||
{
|
||||
GtkDialog *fc_dialog = GTK_DIALOG (dialog);
|
||||
GtkWidget *action_area;
|
||||
GList *children, *l;
|
||||
|
||||
dialog->priv->response_requested = TRUE;
|
||||
@@ -231,8 +239,8 @@ file_chooser_widget_response_requested (GtkWidget *widget,
|
||||
/* There probably isn't a default widget, so make things easier for the
|
||||
* programmer by looking for a reasonable button on our own.
|
||||
*/
|
||||
|
||||
children = gtk_container_get_children (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area));
|
||||
action_area = gtk_dialog_get_action_area (fc_dialog);
|
||||
children = gtk_container_get_children (GTK_CONTAINER (action_area));
|
||||
|
||||
for (l = children; l; l = l->next)
|
||||
{
|
||||
@@ -240,7 +248,7 @@ file_chooser_widget_response_requested (GtkWidget *widget,
|
||||
int response_id;
|
||||
|
||||
widget = GTK_WIDGET (l->data);
|
||||
response_id = gtk_dialog_get_response_for_widget (GTK_DIALOG (dialog), widget);
|
||||
response_id = gtk_dialog_get_response_for_widget (fc_dialog, widget);
|
||||
if (is_stock_accept_response_id (response_id))
|
||||
{
|
||||
gtk_widget_activate (widget); /* Should we gtk_dialog_response (dialog, response_id) instead? */
|
||||
@@ -260,6 +268,7 @@ gtk_file_chooser_dialog_constructor (GType type,
|
||||
GObjectConstructParam *construct_params)
|
||||
{
|
||||
GtkFileChooserDialogPrivate *priv;
|
||||
GtkWidget *content_area;
|
||||
GObject *object;
|
||||
|
||||
object = G_OBJECT_CLASS (gtk_file_chooser_dialog_parent_class)->constructor (type,
|
||||
@@ -282,8 +291,10 @@ gtk_file_chooser_dialog_constructor (GType type,
|
||||
g_signal_connect (priv->widget, "response-requested",
|
||||
G_CALLBACK (file_chooser_widget_response_requested), object);
|
||||
|
||||
content_area = gtk_dialog_get_content_area (GTK_DIALOG (object));
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (priv->widget), 5);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (object)->vbox), priv->widget, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (content_area), priv->widget, TRUE, TRUE, 0);
|
||||
|
||||
gtk_widget_show (priv->widget);
|
||||
|
||||
@@ -338,7 +349,10 @@ foreach_ensure_default_response_cb (GtkWidget *widget,
|
||||
static void
|
||||
ensure_default_response (GtkFileChooserDialog *dialog)
|
||||
{
|
||||
gtk_container_foreach (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area),
|
||||
GtkWidget *action_area;
|
||||
|
||||
action_area = gtk_dialog_get_action_area (GTK_DIALOG (dialog));
|
||||
gtk_container_foreach (GTK_CONTAINER (action_area),
|
||||
foreach_ensure_default_response_cb,
|
||||
dialog);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ struct _GtkFileChooserDialog
|
||||
{
|
||||
GtkDialog parent_instance;
|
||||
|
||||
GtkFileChooserDialogPrivate *GSEAL (priv);
|
||||
GtkFileChooserDialogPrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkFileChooserDialogClass
|
||||
|
||||
@@ -45,7 +45,7 @@ struct _GtkFileChooserWidget
|
||||
{
|
||||
GtkVBox parent_instance;
|
||||
|
||||
GtkFileChooserWidgetPrivate *GSEAL (priv);
|
||||
GtkFileChooserWidgetPrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkFileChooserWidgetClass
|
||||
|
||||
@@ -30,6 +30,11 @@
|
||||
#include "gtkintl.h"
|
||||
|
||||
|
||||
struct _GtkFixedPriv
|
||||
{
|
||||
GList *children;
|
||||
};
|
||||
|
||||
enum {
|
||||
CHILD_PROP_0,
|
||||
CHILD_PROP_X,
|
||||
@@ -104,6 +109,8 @@ gtk_fixed_class_init (GtkFixedClass *class)
|
||||
G_MAXINT,
|
||||
0,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
g_type_class_add_private (class, sizeof (GtkFixedPriv));
|
||||
}
|
||||
|
||||
static GType
|
||||
@@ -115,9 +122,16 @@ gtk_fixed_child_type (GtkContainer *container)
|
||||
static void
|
||||
gtk_fixed_init (GtkFixed *fixed)
|
||||
{
|
||||
GtkFixedPriv *priv;
|
||||
|
||||
fixed->priv = G_TYPE_INSTANCE_GET_PRIVATE (fixed,
|
||||
GTK_TYPE_FIXED,
|
||||
GtkFixedPriv);
|
||||
priv = fixed->priv;
|
||||
|
||||
gtk_widget_set_has_window (GTK_WIDGET (fixed), FALSE);
|
||||
|
||||
fixed->children = NULL;
|
||||
priv->children = NULL;
|
||||
}
|
||||
|
||||
GtkWidget*
|
||||
@@ -130,9 +144,10 @@ static GtkFixedChild*
|
||||
get_child (GtkFixed *fixed,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
GtkFixedPriv *priv = fixed->priv;
|
||||
GList *children;
|
||||
|
||||
children = fixed->children;
|
||||
|
||||
children = priv->children;
|
||||
while (children)
|
||||
{
|
||||
GtkFixedChild *child;
|
||||
@@ -153,6 +168,7 @@ gtk_fixed_put (GtkFixed *fixed,
|
||||
gint x,
|
||||
gint y)
|
||||
{
|
||||
GtkFixedPriv *priv = fixed->priv;
|
||||
GtkFixedChild *child_info;
|
||||
|
||||
g_return_if_fail (GTK_IS_FIXED (fixed));
|
||||
@@ -165,7 +181,7 @@ gtk_fixed_put (GtkFixed *fixed,
|
||||
|
||||
gtk_widget_set_parent (widget, GTK_WIDGET (fixed));
|
||||
|
||||
fixed->children = g_list_append (fixed->children, child_info);
|
||||
priv->children = g_list_append (priv->children, child_info);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -306,16 +322,20 @@ static void
|
||||
gtk_fixed_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition)
|
||||
{
|
||||
GtkFixed *fixed;
|
||||
GtkFixedPriv *priv;
|
||||
GtkFixed *fixed;
|
||||
GtkFixedChild *child;
|
||||
GList *children;
|
||||
GtkRequisition child_requisition;
|
||||
guint border_width;
|
||||
|
||||
fixed = GTK_FIXED (widget);
|
||||
priv = fixed->priv;
|
||||
|
||||
requisition->width = 0;
|
||||
requisition->height = 0;
|
||||
|
||||
children = fixed->children;
|
||||
children = priv->children;
|
||||
while (children)
|
||||
{
|
||||
child = children->data;
|
||||
@@ -334,22 +354,22 @@ gtk_fixed_size_request (GtkWidget *widget,
|
||||
}
|
||||
}
|
||||
|
||||
requisition->height += GTK_CONTAINER (fixed)->border_width * 2;
|
||||
requisition->width += GTK_CONTAINER (fixed)->border_width * 2;
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (fixed));
|
||||
requisition->height += border_width * 2;
|
||||
requisition->width += border_width * 2;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_fixed_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation)
|
||||
{
|
||||
GtkFixed *fixed;
|
||||
GtkFixed *fixed = GTK_FIXED (widget);
|
||||
GtkFixedPriv *priv = fixed->priv;
|
||||
GtkFixedChild *child;
|
||||
GtkAllocation child_allocation;
|
||||
GtkRequisition child_requisition;
|
||||
GList *children;
|
||||
guint16 border_width;
|
||||
|
||||
fixed = GTK_FIXED (widget);
|
||||
guint border_width;
|
||||
|
||||
widget->allocation = *allocation;
|
||||
|
||||
@@ -362,10 +382,10 @@ gtk_fixed_size_allocate (GtkWidget *widget,
|
||||
allocation->width,
|
||||
allocation->height);
|
||||
}
|
||||
|
||||
border_width = GTK_CONTAINER (fixed)->border_width;
|
||||
|
||||
children = fixed->children;
|
||||
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (fixed));
|
||||
|
||||
children = priv->children;
|
||||
while (children)
|
||||
{
|
||||
child = children->data;
|
||||
@@ -401,15 +421,13 @@ static void
|
||||
gtk_fixed_remove (GtkContainer *container,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
GtkFixed *fixed;
|
||||
GtkFixed *fixed = GTK_FIXED (container);
|
||||
GtkFixedPriv *priv = fixed->priv;
|
||||
GtkFixedChild *child;
|
||||
GtkWidget *widget_container;
|
||||
GtkWidget *widget_container = GTK_WIDGET (container);
|
||||
GList *children;
|
||||
|
||||
fixed = GTK_FIXED (container);
|
||||
widget_container = GTK_WIDGET (container);
|
||||
|
||||
children = fixed->children;
|
||||
children = priv->children;
|
||||
while (children)
|
||||
{
|
||||
child = children->data;
|
||||
@@ -420,7 +438,7 @@ gtk_fixed_remove (GtkContainer *container,
|
||||
|
||||
gtk_widget_unparent (widget);
|
||||
|
||||
fixed->children = g_list_remove_link (fixed->children, children);
|
||||
priv->children = g_list_remove_link (priv->children, children);
|
||||
g_list_free (children);
|
||||
g_free (child);
|
||||
|
||||
@@ -441,10 +459,11 @@ gtk_fixed_forall (GtkContainer *container,
|
||||
gpointer callback_data)
|
||||
{
|
||||
GtkFixed *fixed = GTK_FIXED (container);
|
||||
GtkFixedPriv *priv = fixed->priv;
|
||||
GtkFixedChild *child;
|
||||
GList *children;
|
||||
|
||||
children = fixed->children;
|
||||
children = priv->children;
|
||||
while (children)
|
||||
{
|
||||
child = children->data;
|
||||
|
||||
@@ -44,8 +44,8 @@ G_BEGIN_DECLS
|
||||
#define GTK_IS_FIXED_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_FIXED))
|
||||
#define GTK_FIXED_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_FIXED, GtkFixedClass))
|
||||
|
||||
|
||||
typedef struct _GtkFixed GtkFixed;
|
||||
typedef struct _GtkFixedPriv GtkFixedPriv;
|
||||
typedef struct _GtkFixedClass GtkFixedClass;
|
||||
typedef struct _GtkFixedChild GtkFixedChild;
|
||||
|
||||
@@ -53,7 +53,8 @@ struct _GtkFixed
|
||||
{
|
||||
GtkContainer container;
|
||||
|
||||
GList *GSEAL (children);
|
||||
/* <private> */
|
||||
GtkFixedPriv *priv;
|
||||
};
|
||||
|
||||
struct _GtkFixedClass
|
||||
|
||||
@@ -44,7 +44,6 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define GTK_FONT_BUTTON_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_FONT_BUTTON, GtkFontButtonPrivate))
|
||||
|
||||
struct _GtkFontButtonPrivate
|
||||
{
|
||||
@@ -253,7 +252,9 @@ gtk_font_button_class_init (GtkFontButtonClass *klass)
|
||||
static void
|
||||
gtk_font_button_init (GtkFontButton *font_button)
|
||||
{
|
||||
font_button->priv = GTK_FONT_BUTTON_GET_PRIVATE (font_button);
|
||||
font_button->priv = G_TYPE_INSTANCE_GET_PRIVATE (font_button,
|
||||
GTK_TYPE_FONT_BUTTON,
|
||||
GtkFontButtonPrivate);
|
||||
|
||||
/* Initialize fields */
|
||||
font_button->priv->fontname = g_strdup (_("Sans 12"));
|
||||
@@ -713,9 +714,9 @@ gtk_font_button_clicked (GtkButton *button)
|
||||
gtk_window_get_modal (GTK_WINDOW (parent)));
|
||||
}
|
||||
|
||||
g_signal_connect (font_dialog->ok_button, "clicked",
|
||||
g_signal_connect (gtk_font_selection_dialog_get_ok_button (font_dialog), "clicked",
|
||||
G_CALLBACK (dialog_ok_clicked), font_button);
|
||||
g_signal_connect (font_dialog->cancel_button, "clicked",
|
||||
g_signal_connect (gtk_font_selection_dialog_get_cancel_button (font_dialog), "clicked",
|
||||
G_CALLBACK (dialog_cancel_clicked), font_button);
|
||||
g_signal_connect (font_dialog, "destroy",
|
||||
G_CALLBACK (dialog_destroy), font_button);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user