[RFC] VPNC: port from GtkTable to GtkGrid



Hi,

For newer GTK3 versions, GtkTable is deprecated in favor of GtkGrid.
Attached is a patch that does the change from GtkTable to GtkGrid
(though I omitted handling the gtk2 cases...), but it does change the
layout of the vpn password dialog somewhat.

The old version was working on the assumption that the the 2 extra
columns in the priv->table object were giving the required spacing at
the end of the entry boxes (or at least, that's what seems to be the
case), but that's no longer true with GtkGrid. I'm curious what would
be the best way (gtk_adjustment? gtk_dialog_set_size?), and the ideal
size to give the table or pin the dialog to, if it's even worth doing.

I've also attached a screenshot of how this looks with my patch.

Mathieu Trudel-Lapierre <mathieu tl gmail com>
Freenode: cyphermox, Jabber: mathieu tl gmail com
4096R/EE018C93 1967 8F7D 03A1 8F38 732E  FF82 C126 33E1 EE01 8C93

Attachment: Screenshot at 2012-02-10 16:14:59.png
Description: PNG image

From: Mathieu Trudel-Lapierre <mathieu trudel-lapierre canonical com>
Subject: Port GtkTable uses to GtkGrid, since the former is now deprecated.

Index: network-manager-vpnc-0.9.2.0+git201201080319.236292c/auth-dialog/vpn-password-dialog.c
===================================================================
--- network-manager-vpnc-0.9.2.0+git201201080319.236292c.orig/auth-dialog/vpn-password-dialog.c	2012-02-10 14:41:30.000000000 -0500
+++ network-manager-vpnc-0.9.2.0+git201201080319.236292c/auth-dialog/vpn-password-dialog.c	2012-02-10 15:10:40.120355818 -0500
@@ -123,8 +123,8 @@
 	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 (table), label, 0, row, 1, 1);
+	gtk_grid_attach (GTK_GRID (table), entry, 1, row, 1, 1);
 
 	gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
 }
@@ -153,7 +153,7 @@
 	if (priv->show_password_secondary)
 		add_row (priv->table, row++, priv->secondary_password_label,  priv->password_entry_secondary);
 
-	gtk_table_attach_defaults (GTK_TABLE (priv->table), priv->show_passwords_checkbox, 1, 2, row, row + 1);
+	gtk_grid_attach (GTK_GRID (priv->table), priv->show_passwords_checkbox, 1, row, 1, 1);
 
 	gtk_widget_show_all (priv->table);
 }
@@ -227,9 +227,9 @@
 
 	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);
+	priv->table = gtk_grid_new ();
+	gtk_grid_set_column_spacing (GTK_GRID (priv->table), 12);
+	gtk_grid_set_row_spacing (GTK_GRID (priv->table), 6);
 	gtk_container_add (GTK_CONTAINER (priv->table_alignment), priv->table);
 
 	priv->password_entry = gtk_entry_new ();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]