summaryrefslogtreecommitdiff
path: root/debian/patches/0002-Switch-from-GtkTable-to-GtkGrid.patch
blob: 22efddb0d43a3686155b3095f71df2dd94893e0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx@sigxcpu.org>
Date: Sat, 11 May 2013 16:37:48 +0200
Subject: Switch from GtkTable to GtkGrid

since gtk_table_attach_defaults is deprecated.
---
 auth-dialog/vpn-password-dialog.c |   56 ++++++++++++++++++-------------------
 1 file changed, 28 insertions(+), 28 deletions(-)

diff --git a/auth-dialog/vpn-password-dialog.c b/auth-dialog/vpn-password-dialog.c
index 28ce19b..79af9f7 100644
--- a/auth-dialog/vpn-password-dialog.c
+++ b/auth-dialog/vpn-password-dialog.c
@@ -43,8 +43,8 @@ typedef struct {
 	GtkWidget *password_entry;
 	GtkWidget *show_passwords_checkbox;
 
-	GtkWidget *table_alignment;
-	GtkWidget *table;
+	GtkWidget *grid_alignment;
+	GtkWidget *grid;
 	GtkSizeGroup *group;
 	
 	char *primary_password_label;
@@ -108,44 +108,44 @@ dialog_close_callback (GtkWidget *widget, gpointer callback_data)
 }
 
 static void
-add_row (GtkWidget *table, int row, const char *label_text, GtkWidget *entry)
+add_row (GtkWidget *grid, int row, const char *label_text, GtkWidget *entry)
 {
 	GtkWidget *label;
 
 	label = gtk_label_new_with_mnemonic (label_text);
 	gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
 
-	gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, row, row + 1);
-	gtk_table_attach_defaults (GTK_TABLE (table), entry, 1, 2, row, row + 1);
+	gtk_grid_attach (GTK_GRID (grid), label, 0, 1, 1, 1);
+	gtk_grid_attach (GTK_GRID (grid), entry, 1, 1, 1, 1);
 
 	gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
 }
 
 static void
-remove_child (GtkWidget *child, GtkWidget *table)
+remove_child (GtkWidget *child, GtkWidget *grid)
 {
-	gtk_container_remove (GTK_CONTAINER (table), child);
+	gtk_container_remove (GTK_CONTAINER (grid), child);
 }
 
 static void
-add_table_rows (VpnPasswordDialog *dialog)
+add_grid_rows (VpnPasswordDialog *dialog)
 {
 	VpnPasswordDialogPrivate *priv = VPN_PASSWORD_DIALOG_GET_PRIVATE (dialog);
-	int row;
+	int row = 0;
 	int offset = 0;
 
-	gtk_alignment_set_padding (GTK_ALIGNMENT (priv->table_alignment), 0, 0, offset, 0);
+	gtk_alignment_set_padding (GTK_ALIGNMENT (priv->grid_alignment), 0, 0, offset, 0);
 
 	/* This will not kill the entries, since they are ref:ed */
-	gtk_container_foreach (GTK_CONTAINER (priv->table), (GtkCallback) remove_child, priv->table);
+	gtk_container_foreach (GTK_CONTAINER (priv->grid), (GtkCallback) remove_child, priv->grid);
 	
-	row = 0;
 	if (priv->show_password)
-		add_row (priv->table, row++, priv->primary_password_label, priv->password_entry);
+		add_row (priv->grid, row++, priv->primary_password_label, priv->password_entry);
 
-	gtk_table_attach_defaults (GTK_TABLE (priv->table), priv->show_passwords_checkbox, 1, 2, row, row + 1);
-
-	gtk_widget_show_all (priv->table);
+	gtk_grid_attach (GTK_GRID (priv->grid),
+					 priv->show_passwords_checkbox,
+					 1, 2, 1, 1);
+	gtk_widget_show_all (priv->grid);
 }
 
 static void
@@ -208,21 +208,21 @@ vpn_password_dialog_new (const char *title,
 	                  G_CALLBACK (dialog_close_callback),
 	                  dialog);
 
-	/* The table that holds the captions */
-	priv->table_alignment = gtk_alignment_new (0.0, 0.0, 0.0, 0.0);
+	/* The grid that holds the captions */
+	priv->grid_alignment = gtk_alignment_new (0.0, 0.0, 0.0, 0.0);
 
 	priv->group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
 
-	priv->table = gtk_table_new (4, 2, FALSE);
-	gtk_table_set_col_spacings (GTK_TABLE (priv->table), 12);
-	gtk_table_set_row_spacings (GTK_TABLE (priv->table), 6);
-	gtk_container_add (GTK_CONTAINER (priv->table_alignment), priv->table);
+	priv->grid = gtk_grid_new ();
+	gtk_grid_set_column_spacing (GTK_GRID (priv->grid), 12);
+	gtk_grid_set_row_spacing (GTK_GRID (priv->grid), 6);
+	gtk_container_add (GTK_CONTAINER (priv->grid_alignment), priv->grid);
 
 	priv->password_entry = gtk_entry_new ();
 
 	priv->show_passwords_checkbox = gtk_check_button_new_with_mnemonic (_("Sh_ow passwords"));
 
-	/* We want to hold on to these during the table rearrangement */
+	/* We want to hold on to these during the grid rearrangement */
 	g_object_ref_sink (priv->password_entry);
 	g_object_ref_sink (priv->show_passwords_checkbox);
 	
@@ -236,7 +236,7 @@ vpn_password_dialog_new (const char *title,
 	                  G_CALLBACK (show_passwords_toggled_cb),
 	                  dialog);
 
-	add_table_rows (VPN_PASSWORD_DIALOG (dialog));
+	add_grid_rows (VPN_PASSWORD_DIALOG (dialog));
 
 	/* Adds some eye-candy to the dialog */
 #if GTK_CHECK_VERSION (3,1,6)
@@ -263,7 +263,7 @@ vpn_password_dialog_new (const char *title,
 		gtk_label_set_max_width_chars (message_label, 35);
 		gtk_size_group_add_widget (priv->group, GTK_WIDGET (message_label));
 		gtk_box_pack_start (GTK_BOX (main_vbox), GTK_WIDGET (message_label), FALSE, FALSE, 0);
-		gtk_size_group_add_widget (priv->group, priv->table_alignment);
+		gtk_size_group_add_widget (priv->group, priv->grid_alignment);
 	}
 
 #if GTK_CHECK_VERSION (3,1,6)
@@ -272,7 +272,7 @@ vpn_password_dialog_new (const char *title,
 	vbox = gtk_vbox_new (FALSE, 6);
 #endif
 	gtk_box_pack_start (GTK_BOX (main_vbox), vbox, FALSE, FALSE, 0);
-	gtk_box_pack_start (GTK_BOX (vbox), priv->table_alignment, FALSE, FALSE, 0);
+	gtk_box_pack_start (GTK_BOX (vbox), priv->grid_alignment, FALSE, FALSE, 0);
 	gtk_box_pack_start (GTK_BOX (hbox), main_vbox, FALSE, FALSE, 0);
 	gtk_box_pack_start (content, hbox, FALSE, FALSE, 0);
 	gtk_widget_show_all (GTK_WIDGET (content));
@@ -321,7 +321,7 @@ vpn_password_dialog_set_show_password (VpnPasswordDialog *dialog, gboolean show)
 	show = !!show;
 	if (priv->show_password != show) {
 		priv->show_password = show;
-		add_table_rows (dialog);
+		add_grid_rows (dialog);
 	}
 }
 
@@ -363,6 +363,6 @@ void vpn_password_dialog_set_password_label (VpnPasswordDialog *dialog,
 	priv->primary_password_label = g_strdup (label);
 
 	if (priv->show_password)
-		add_table_rows (dialog);
+		add_grid_rows (dialog);
 }