[frogr] Migrate from GtkTable to GtkGrid
- From: Mario Sanchez Prada <msanchez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [frogr] Migrate from GtkTable to GtkGrid
- Date: Mon, 10 Dec 2012 09:32:31 +0000 (UTC)
commit 17c9944d8abfdffa8b04f5ef635bc14d618b8f22
Author: Mario Sanchez Prada <msanchez gnome org>
Date: Mon Dec 10 10:12:04 2012 +0100
Migrate from GtkTable to GtkGrid
GtkTable has been deprecated in Gtk 3.4
src/frogr-create-new-set-dialog.c | 41 +++++++++-------------
src/frogr-details-dialog.c | 43 ++++++++++-------------
src/frogr-settings-dialog.c | 66 +++++++++++++------------------------
3 files changed, 59 insertions(+), 91 deletions(-)
---
diff --git a/src/frogr-create-new-set-dialog.c b/src/frogr-create-new-set-dialog.c
index 3fd9c88..47b1a87 100644
--- a/src/frogr-create-new-set-dialog.c
+++ b/src/frogr-create-new-set-dialog.c
@@ -315,8 +315,7 @@ frogr_create_new_set_dialog_init (FrogrCreateNewSetDialog *self)
{
FrogrCreateNewSetDialogPrivate *priv = NULL;
GtkWidget *vbox = NULL;
- GtkWidget *table = NULL;
- GtkWidget *align = NULL;
+ GtkWidget *grid = NULL;
GtkWidget *scroller = NULL;
GtkWidget *widget = NULL;
@@ -335,27 +334,24 @@ frogr_create_new_set_dialog_init (FrogrCreateNewSetDialog *self)
vbox = gtk_dialog_get_content_area (GTK_DIALOG (self));
- table = gtk_table_new (2, 2, FALSE);
- gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 6);
+ grid = gtk_grid_new ();
+ gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
+ gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
+ gtk_box_pack_start (GTK_BOX (vbox), grid, TRUE, TRUE, 6);
widget = gtk_label_new (_("Title:"));
- align = gtk_alignment_new (1, 0, 1, 0);
- gtk_container_add (GTK_CONTAINER (align), widget);
- gtk_table_attach (GTK_TABLE (table), align, 0, 1, 0, 1,
- 0, 0, 6, 6);
+ gtk_widget_set_halign (GTK_WIDGET (widget), GTK_ALIGN_END);
+ gtk_grid_attach (GTK_GRID (grid), widget, 0, 0, 1, 1);
widget = gtk_entry_new ();
- align = gtk_alignment_new (1, 0, 1, 0);
- gtk_container_add (GTK_CONTAINER (align), widget);
- gtk_table_attach (GTK_TABLE (table), align, 1, 2, 0, 1,
- GTK_EXPAND | GTK_FILL, 0, 6, 6);
+ gtk_widget_set_hexpand (GTK_WIDGET (widget), TRUE);
+ gtk_grid_attach (GTK_GRID (grid), widget, 1, 0, 1, 1);
priv->title_entry = widget;
widget = gtk_label_new (_("Description:"));
- align = gtk_alignment_new (1, 0, 1, 0);
- gtk_container_add (GTK_CONTAINER (align), widget);
- gtk_table_attach (GTK_TABLE (table), align, 0, 1, 1, 2,
- 0, GTK_EXPAND | GTK_FILL, 6, 6);
+ gtk_widget_set_halign (GTK_WIDGET (widget), GTK_ALIGN_END);
+ gtk_widget_set_valign (GTK_WIDGET (widget), GTK_ALIGN_START);
+ gtk_grid_attach (GTK_GRID (grid), widget, 0, 1, 1, 1);
widget = gtk_text_view_new ();
scroller = gtk_scrolled_window_new (NULL, NULL);
@@ -366,19 +362,16 @@ frogr_create_new_set_dialog_init (FrogrCreateNewSetDialog *self)
gtk_container_add (GTK_CONTAINER (scroller), widget);
gtk_text_view_set_accepts_tab (GTK_TEXT_VIEW (widget), FALSE);
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (widget), GTK_WRAP_WORD);
- align = gtk_alignment_new (1, 0, 1, 1);
- gtk_container_add (GTK_CONTAINER (align), scroller);
- gtk_table_attach (GTK_TABLE (table), align, 1, 2, 1, 2,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 6, 6);
+ gtk_widget_set_hexpand (GTK_WIDGET (scroller), TRUE);
+ gtk_widget_set_vexpand (GTK_WIDGET (scroller), TRUE);
+ gtk_grid_attach (GTK_GRID (grid), scroller, 1, 1, 1, 1);
priv->description_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget));
priv->description_tv = widget;
widget = gtk_check_button_new_with_mnemonic (_("Fill Pictures Details with Title and Description"));
- align = gtk_alignment_new (1, 0, 1, 0);
- gtk_container_add (GTK_CONTAINER (align), widget);
- gtk_table_attach (GTK_TABLE (table), align, 1, 2, 2, 3,
- GTK_EXPAND | GTK_FILL, 0, 6, 6);
+ gtk_widget_set_hexpand (GTK_WIDGET (widget), TRUE);
+ gtk_grid_attach (GTK_GRID (grid), widget, 1, 2, 1, 1);
priv->copy_to_pictures_cb = widget;
g_signal_connect (G_OBJECT (priv->copy_to_pictures_cb), "toggled",
diff --git a/src/frogr-details-dialog.c b/src/frogr-details-dialog.c
index 59d8819..1f562da 100644
--- a/src/frogr-details-dialog.c
+++ b/src/frogr-details-dialog.c
@@ -153,11 +153,10 @@ _create_widgets (FrogrDetailsDialog *self)
GtkWidget *private_vbox = NULL;
GtkWidget *content_type_hbox = NULL;
GtkWidget *safety_level_hbox = NULL;
-
GtkWidget *align = NULL;
GtkWidget *label = NULL;
GtkWidget *widget = NULL;
- GtkWidget *table = NULL;
+ GtkWidget *grid = NULL;
GtkWidget *scroller = NULL;
gchar *markup = NULL;
gint i;
@@ -365,25 +364,24 @@ _create_widgets (FrogrDetailsDialog *self)
/* Right side (text fields) */
- table = gtk_table_new (3, 2, FALSE);
+ grid = gtk_grid_new ();
+ gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
+ gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
label = gtk_label_new_with_mnemonic (_("_Title:"));
- align = gtk_alignment_new (1, 0, 1, 0);
- gtk_container_add (GTK_CONTAINER (align), label);
- gtk_table_attach (GTK_TABLE (table), align, 0, 1, 0, 1,
- 0, 0, 6, 6);
+ gtk_widget_set_halign (GTK_WIDGET (label), GTK_ALIGN_END);
+ gtk_grid_attach (GTK_GRID (grid), label, 0, 0, 1, 1);
widget = gtk_entry_new ();
gtk_label_set_mnemonic_widget (GTK_LABEL (label), widget);
- gtk_table_attach (GTK_TABLE (table), widget, 1, 2, 0, 1,
- GTK_EXPAND | GTK_FILL, 0, 6, 6);
+ gtk_widget_set_hexpand (GTK_WIDGET (widget), TRUE);
+ gtk_grid_attach (GTK_GRID (grid), widget, 1, 0, 1, 1);
priv->title_entry = widget;
label = gtk_label_new_with_mnemonic (_("_Description:"));
- align = gtk_alignment_new (1, 0, 1, 0);
- gtk_container_add (GTK_CONTAINER (align), label);
- gtk_table_attach (GTK_TABLE (table), align, 0, 1, 1, 2,
- 0, GTK_EXPAND | GTK_FILL, 6, 6);
+ gtk_widget_set_halign (GTK_WIDGET (label), GTK_ALIGN_END);
+ gtk_widget_set_valign (GTK_WIDGET (label), GTK_ALIGN_START);
+ gtk_grid_attach (GTK_GRID (grid), label, 0, 1, 1, 1);
widget = gtk_text_view_new ();
gtk_label_set_mnemonic_widget (GTK_LABEL (label), widget);
@@ -397,27 +395,24 @@ _create_widgets (FrogrDetailsDialog *self)
GTK_SHADOW_ETCHED_IN);
gtk_container_add (GTK_CONTAINER (scroller), widget);
- align = gtk_alignment_new (1, 0, 1, 1);
- gtk_container_add (GTK_CONTAINER (align), scroller);
- gtk_table_attach (GTK_TABLE (table), align, 1, 2, 1, 2,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 6, 6);
+ gtk_widget_set_hexpand (GTK_WIDGET (scroller), TRUE);
+ gtk_widget_set_vexpand (GTK_WIDGET (scroller), TRUE);
+ gtk_grid_attach (GTK_GRID (grid), scroller, 1, 1, 1, 1);
priv->desc_tview = widget;
priv->text_buffer =
gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->desc_tview));
label = gtk_label_new_with_mnemonic (_("Ta_gs:"));
- align = gtk_alignment_new (1, 0, 1, 0);
- gtk_container_add (GTK_CONTAINER (align), label);
- gtk_table_attach (GTK_TABLE (table), align, 0, 1, 2, 3,
- 0, 0, 6, 6);
+ gtk_widget_set_halign (GTK_WIDGET (label), GTK_ALIGN_END);
+ gtk_grid_attach (GTK_GRID (grid), label, 0, 2, 1, 1);
widget = frogr_live_entry_new ();
gtk_label_set_mnemonic_widget (GTK_LABEL (label), widget);
- gtk_table_attach (GTK_TABLE (table), widget, 1, 2, 2, 3,
- GTK_EXPAND | GTK_FILL, 0, 6, 6);
+ gtk_widget_set_hexpand (GTK_WIDGET (widget), TRUE);
+ gtk_grid_attach (GTK_GRID (grid), widget, 1, 2, 1, 1);
priv->tags_entry = widget;
- gtk_box_pack_start (GTK_BOX (hbox), table, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), grid, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (main_vbox), hbox, TRUE, TRUE, 6);
diff --git a/src/frogr-settings-dialog.c b/src/frogr-settings-dialog.c
index f16b636..ac8b5c7 100644
--- a/src/frogr-settings-dialog.c
+++ b/src/frogr-settings-dialog.c
@@ -329,7 +329,7 @@ _add_connection_page (FrogrSettingsDialog *self, GtkNotebook *notebook)
{
FrogrSettingsDialogPrivate *priv = NULL;
GtkWidget *vbox = NULL;
- GtkWidget *table = NULL;
+ GtkWidget *grid = NULL;
GtkWidget *align = NULL;
GtkWidget *cbutton = NULL;
GtkWidget *label = NULL;
@@ -364,77 +364,59 @@ _add_connection_page (FrogrSettingsDialog *self, GtkNotebook *notebook)
/* Proxy host */
- table = gtk_table_new (2, 4, FALSE);
+ grid = gtk_grid_new ();
+ gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
+ gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
label = gtk_label_new_with_mnemonic (_("_Host:"));
- align = gtk_alignment_new (0, 0, 0, 0);
- gtk_container_add (GTK_CONTAINER (align), label);
- gtk_table_attach (GTK_TABLE (table), align, 0, 1, 0, 1,
- GTK_FILL, 0, 6, 6);
+ gtk_widget_set_halign (GTK_WIDGET (label), GTK_ALIGN_END);
+ gtk_grid_attach (GTK_GRID (grid), label, 0, 0, 1, 1);
priv->proxy_host_label = label;
entry = gtk_entry_new ();
gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
-
- align = gtk_alignment_new (1, 0, 1, 0);
- gtk_container_add (GTK_CONTAINER (align), entry);
- gtk_table_attach (GTK_TABLE (table), align, 1, 2, 0, 1,
- GTK_EXPAND | GTK_FILL, 0, 6, 6);
+ gtk_widget_set_hexpand (GTK_WIDGET (entry), TRUE);
+ gtk_grid_attach (GTK_GRID (grid), entry, 1, 0, 1, 1);
priv->proxy_host_entry = entry;
/* Proxy port */
label = gtk_label_new_with_mnemonic (_("_Port:"));
- align = gtk_alignment_new (0, 0, 0, 0);
- gtk_container_add (GTK_CONTAINER (align), label);
- gtk_table_attach (GTK_TABLE (table), align, 0, 1, 1, 2,
- GTK_FILL, 0, 6, 6);
+ gtk_widget_set_halign (GTK_WIDGET (label), GTK_ALIGN_END);
+ gtk_grid_attach (GTK_GRID (grid), label, 0, 1, 1, 1);
priv->proxy_port_label = label;
entry = gtk_entry_new ();
gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
-
- align = gtk_alignment_new (1, 0, 1, 0);
- gtk_container_add (GTK_CONTAINER (align), entry);
- gtk_table_attach (GTK_TABLE (table), align, 1, 2, 1, 2,
- GTK_EXPAND | GTK_FILL, 0, 6, 6);
+ gtk_widget_set_hexpand (GTK_WIDGET (entry), TRUE);
+ gtk_grid_attach (GTK_GRID (grid), entry, 1, 1, 1, 1);
priv->proxy_port_entry = entry;
/* Proxy username */
label = gtk_label_new_with_mnemonic (_("U_sername:"));
- align = gtk_alignment_new (0, 0, 0, 0);
- gtk_container_add (GTK_CONTAINER (align), label);
- gtk_table_attach (GTK_TABLE (table), align, 0, 1, 2, 3,
- GTK_FILL, 0, 6, 6);
+ gtk_widget_set_halign (GTK_WIDGET (label), GTK_ALIGN_END);
+ gtk_grid_attach (GTK_GRID (grid), label, 0, 2, 1, 1);
priv->proxy_username_label = label;
entry = gtk_entry_new ();
gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
-
- align = gtk_alignment_new (1, 0, 1, 0);
- gtk_container_add (GTK_CONTAINER (align), entry);
- gtk_table_attach (GTK_TABLE (table), align, 1, 2, 2, 3,
- GTK_EXPAND | GTK_FILL, 0, 6, 6);
+ gtk_widget_set_hexpand (GTK_WIDGET (entry), TRUE);
+ gtk_grid_attach (GTK_GRID (grid), entry, 1, 2, 1, 1);
priv->proxy_username_entry = entry;
/* Proxy password */
label = gtk_label_new_with_mnemonic (_("Pass_word:"));
- align = gtk_alignment_new (0, 0, 0, 0);
- gtk_container_add (GTK_CONTAINER (align), label);
- gtk_table_attach (GTK_TABLE (table), align, 0, 1, 3, 4,
- GTK_FILL, 0, 6, 6);
+ gtk_widget_set_halign (GTK_WIDGET (label), GTK_ALIGN_END);
+ gtk_grid_attach (GTK_GRID (grid), label, 0, 3, 1, 1);
priv->proxy_password_label = label;
entry = gtk_entry_new ();
gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
-
gtk_entry_set_visibility (GTK_ENTRY (entry), FALSE);
- align = gtk_alignment_new (1, 0, 1, 0);
- gtk_container_add (GTK_CONTAINER (align), entry);
- gtk_table_attach (GTK_TABLE (table), align, 1, 2, 3, 4,
- GTK_EXPAND | GTK_FILL, 0, 6, 6);
+ gtk_widget_set_hexpand (GTK_WIDGET (entry), TRUE);
+ gtk_grid_attach (GTK_GRID (grid), entry, 1, 3, 1, 1);
priv->proxy_password_entry = entry;
#ifdef HAVE_LIBSOUP_GNOME
@@ -442,14 +424,12 @@ _add_connection_page (FrogrSettingsDialog *self, GtkNotebook *notebook)
/* Use GNOME General Proxy Settings */
cbutton = gtk_check_button_new_with_mnemonic (_("_Use GNOME General Proxy Settings"));
- align = gtk_alignment_new (1, 0, 1, 0);
- gtk_container_add (GTK_CONTAINER (align), cbutton);
- gtk_table_attach (GTK_TABLE (table), align, 1, 2, 4, 5,
- GTK_EXPAND | GTK_FILL, 0, 6, 6);
+ gtk_widget_set_hexpand (GTK_WIDGET (cbutton), TRUE);
+ gtk_grid_attach (GTK_GRID (grid), cbutton, 1, 4, 1, 1);
priv->use_gnome_proxy_cb = cbutton;
#endif
- gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), grid, FALSE, FALSE, 0);
/* Connect signals */
g_signal_connect (G_OBJECT (priv->use_proxy_cb), "toggled",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]