[balsa/gtk3] Port folder dialog from GtkTable to GtkGrid
- From: Peter Bloomfield <PeterB src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/gtk3] Port folder dialog from GtkTable to GtkGrid
- Date: Fri, 7 Oct 2011 00:39:58 +0000 (UTC)
commit 9310777abad886592436ceef9beaf569dac521c0
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Thu Oct 6 20:38:56 2011 -0400
Port folder dialog from GtkTable to GtkGrid
* src/folder-conf.c (folder_conf_imap_node),
(folder_conf_imap_sub_node): migrate from GtkTable to GtkGrid.
ChangeLog | 5 ++
src/folder-conf.c | 130 ++++++++++++++++++++++++++++------------------------
2 files changed, 75 insertions(+), 60 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 9ba2470..7c5ce3f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2011-10-06 Peter Bloomfield
+ * src/folder-conf.c (folder_conf_imap_node),
+ (folder_conf_imap_sub_node): migrate from GtkTable to GtkGrid.
+
+2011-10-06 Peter Bloomfield
+
* src/filter-edit-dialog.c (build_match_page),
(fe_make_color_buttons), (build_action_page),
(build_right_side): migrate from GtkTable to GtkGrid.
diff --git a/src/folder-conf.c b/src/folder-conf.c
index ac89548..ebb0144 100644
--- a/src/folder-conf.c
+++ b/src/folder-conf.c
@@ -266,7 +266,7 @@ folder_conf_clicked_ok(FolderDialogData * fcw)
void
folder_conf_imap_node(BalsaMailboxNode *mn)
{
- GtkWidget *notebook, *table, *label, *advanced;
+ GtkWidget *notebook, *grid, *label, *advanced;
FolderDialogData *fcw;
static FolderDialogData *fcw_new;
LibBalsaServer *s;
@@ -323,9 +323,9 @@ folder_conf_imap_node(BalsaMailboxNode *mn)
notebook = gtk_notebook_new();
gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(fcw->dialog)),
notebook, TRUE, TRUE, 0);
- table = libbalsa_create_table(9, 2);
- gtk_container_set_border_width(GTK_CONTAINER(table), 12);
- gtk_notebook_append_page(GTK_NOTEBOOK(notebook), table,
+ grid = libbalsa_create_grid();
+ gtk_container_set_border_width(GTK_CONTAINER(grid), 12);
+ gtk_notebook_append_page(GTK_NOTEBOOK(notebook), grid,
gtk_label_new_with_mnemonic(_("_Basic")));
advanced = balsa_server_conf_get_advanced_widget(&fcw->bsc, s, 3);
/* Limit number of connections */
@@ -369,50 +369,56 @@ folder_conf_imap_node(BalsaMailboxNode *mn)
gtk_label_new_with_mnemonic(_("_Advanced")));
/* INPUT FIELD CREATION */
- label = libbalsa_create_label(_("Descriptive _name:"), table, 0);
- fcw->folder_name = libbalsa_create_entry(table,
- G_CALLBACK(validate_folder),
- fcw, r++, mn ? mn->name : NULL,
+ label = libbalsa_create_grid_label(_("Descriptive _name:"), grid, 0);
+ fcw->folder_name =
+ libbalsa_create_grid_entry(grid, G_CALLBACK(validate_folder),
+ fcw, r++, mn ? mn->name : NULL,
label);
default_server = libbalsa_guess_imap_server();
- label = libbalsa_create_label(_("_Server:"), table, 1);
- fcw->bsc.server = libbalsa_create_entry(table,
- G_CALLBACK(validate_folder),
- fcw, r++, s ? s->host : default_server,
- label);
+ label = libbalsa_create_grid_label(_("_Server:"), grid, 1);
+ fcw->bsc.server =
+ libbalsa_create_grid_entry(grid, G_CALLBACK(validate_folder),
+ fcw, r++, s ? s->host : default_server,
+ label);
fcw->bsc.default_ports = IMAP_DEFAULT_PORTS;
g_free(default_server);
- label= libbalsa_create_label(_("Use_r name:"), table, r);
- fcw->username = libbalsa_create_entry(table,
- G_CALLBACK(validate_folder),
- fcw, r++, s ? s->user : g_get_user_name(),
- label);
+ label= libbalsa_create_grid_label(_("Use_r name:"), grid, r);
+ fcw->username =
+ libbalsa_create_grid_entry(grid, G_CALLBACK(validate_folder),
+ fcw, r++, s ? s->user : g_get_user_name(),
+ label);
- label = libbalsa_create_label(_("_Password:"), table, r);
- fcw->password = libbalsa_create_entry(table, NULL, NULL, r++,
- s ? s->passwd : NULL, label);
+ label = libbalsa_create_grid_label(_("_Password:"), grid, r);
+ fcw->password =
+ libbalsa_create_grid_entry(grid, NULL, NULL, r++,
+ s ? s->passwd : NULL, label);
gtk_entry_set_visibility(GTK_ENTRY(fcw->password), FALSE);
- fcw->anonymous = libbalsa_create_check(_("_Anonymous access"),
- table, r++, s ? s->try_anonymous : FALSE);
+ fcw->anonymous =
+ libbalsa_create_grid_check(_("_Anonymous access"), grid, r++,
+ s ? s->try_anonymous : FALSE);
g_signal_connect(G_OBJECT(fcw->anonymous), "toggled",
G_CALLBACK(anonymous_cb), fcw);
- fcw->remember = libbalsa_create_check(_(remember_password_message),
- table, r++, s ? s->remember_passwd : TRUE);
+ fcw->remember =
+ libbalsa_create_grid_check(_(remember_password_message), grid, r++,
+ s ? s->remember_passwd : TRUE);
g_signal_connect(G_OBJECT(fcw->remember), "toggled",
G_CALLBACK(remember_cb), fcw);
- fcw->subscribed = libbalsa_create_check(_("Subscribed _folders only"),
- table, r++, mn ? mn->subscribed : FALSE);
- fcw->list_inbox = libbalsa_create_check(_("Always show _INBOX"),
- table, r++, mn ? mn->list_inbox : TRUE);
+ fcw->subscribed =
+ libbalsa_create_grid_check(_("Subscribed _folders only"), grid, r++,
+ mn ? mn->subscribed : FALSE);
+ fcw->list_inbox =
+ libbalsa_create_grid_check(_("Always show _INBOX"), grid, r++,
+ mn ? mn->list_inbox : TRUE);
+
+ label = libbalsa_create_grid_label(_("Pr_efix:"), grid, r);
+ fcw->prefix =
+ libbalsa_create_grid_entry(grid, NULL, NULL, r++,
+ mn ? mn->dir : NULL, label);
- label = libbalsa_create_label(_("Pr_efix:"), table, r);
- fcw->prefix = libbalsa_create_entry(table, NULL, NULL, r++,
- mn ? mn->dir : NULL, label);
-
gtk_widget_show_all(GTK_WIDGET(fcw->dialog));
validate_folder(NULL, fcw);
@@ -749,7 +755,7 @@ set_ok_sensitive(GtkDialog * dialog)
void
folder_conf_imap_sub_node(BalsaMailboxNode * mn)
{
- GtkWidget *content, *table, *button, *label, *hbox;
+ GtkWidget *content, *grid, *button, *label, *hbox;
SubfolderDialogData *sdd;
static SubfolderDialogData *sdd_new = NULL;
guint row;
@@ -812,37 +818,42 @@ folder_conf_imap_sub_node(BalsaMailboxNode * mn)
(gpointer) &sdd_new);
}
- table = libbalsa_create_table(3, 2);
- gtk_table_set_row_spacings(GTK_TABLE(table), 6);
- gtk_table_set_col_spacings(GTK_TABLE(table), 12);
- gtk_container_set_border_width(GTK_CONTAINER(table), 12);
+ grid = libbalsa_create_grid();
+#if GTK_CHECK_VERSION(3, 2, 0)
+ gtk_grid_set_row_spacing(GTK_GRID(grid), 6);
+ gtk_grid_set_column_spacing(GTK_GRID(grid), 12);
+#else /* GTK_CHECK_VERSION(3, 2, 0) */
+ gtk_grid_set_row_spacing(GTK_GRID(grid), 12);
+ gtk_grid_set_column_spacing(GTK_GRID(grid), 6);
+#endif /* GTK_CHECK_VERSION(3, 2, 0) */
+ gtk_container_set_border_width(GTK_CONTAINER(grid), 12);
if (mn)
- content = table;
+ content = grid;
else {
content = gtk_frame_new(_("Create subfolder"));
- gtk_container_add(GTK_CONTAINER(content), table);
+ gtk_container_add(GTK_CONTAINER(content), grid);
}
gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(sdd->dialog)),
content, TRUE, TRUE, 0);
row = 0;
/* INPUT FIELD CREATION */
- label= libbalsa_create_label(_("_Folder name:"), table, row);
+ label= libbalsa_create_grid_label(_("_Folder name:"), grid, row);
sdd->folder_name =
- libbalsa_create_entry(table, G_CALLBACK(validate_sub_folder),
- sdd, row, sdd->old_folder, label);
+ libbalsa_create_grid_entry(grid, G_CALLBACK(validate_sub_folder),
+ sdd, row, sdd->old_folder, label);
++row;
- label = libbalsa_create_label(_("Host:"), table, row);
- sdd->host_label =
+ label = libbalsa_create_grid_label(_("Host:"), grid, row);
+ sdd->host_label =
gtk_label_new(sdd->mbnode && sdd->mbnode->server
? sdd->mbnode->server->host : "");
- gtk_misc_set_alignment(GTK_MISC(sdd->host_label), 0.0, 0.5);
- gtk_table_attach(GTK_TABLE(table), sdd->host_label, 1, 2, row, row + 1,
- GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_set_halign(sdd->host_label, GTK_ALIGN_START);
+ gtk_widget_set_hexpand(sdd->host_label, TRUE);
+ gtk_grid_attach(GTK_GRID(grid), sdd->host_label, 1, row, 1, 1);
++row;
- label = libbalsa_create_label(_("Subfolder of:"), table, row);
+ label = libbalsa_create_grid_label(_("Subfolder of:"), grid, row);
sdd->parent_folder = gtk_entry_new();
gtk_editable_set_editable(GTK_EDITABLE(sdd->parent_folder), FALSE);
gtk_entry_set_text(GTK_ENTRY(sdd->parent_folder), sdd->old_parent);
@@ -852,10 +863,10 @@ folder_conf_imap_sub_node(BalsaMailboxNode * mn)
G_CALLBACK(browse_button_cb), (gpointer) sdd);
hbox = gtk_hbox_new(FALSE, 12);
+ gtk_widget_set_hexpand(hbox, TRUE);
gtk_box_pack_start(GTK_BOX(hbox), sdd->parent_folder, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
- gtk_table_attach(GTK_TABLE(table), hbox, 1, 2, row, row + 1,
- GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_grid_attach(GTK_GRID(grid), hbox, 1, row, 1, 1);
if (!mn)
validate_sub_folder(NULL, sdd);
@@ -873,7 +884,7 @@ folder_conf_imap_sub_node(BalsaMailboxNode * mn)
gchar * quotas;
++row;
- label = libbalsa_create_label(_("Permissions:"), table, row);
+ label = libbalsa_create_grid_label(_("Permissions:"), grid, row);
/* mailbox closed: no detailed permissions available */
if (!libbalsa_mailbox_imap_is_connected(LIBBALSA_MAILBOX_IMAP(mn->mailbox))) {
@@ -929,13 +940,12 @@ folder_conf_imap_sub_node(BalsaMailboxNode * mn)
}
rights = g_string_free(rights_str, FALSE);
label = gtk_label_new(rights);
- gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
- gtk_table_attach(GTK_TABLE(table), label, 1, 2, row, row + 1,
- GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_set_halign(label, GTK_ALIGN_START);
+ gtk_grid_attach(GTK_GRID(grid), label, 1, row, 1, 1);
g_free(rights);
++row;
- label = libbalsa_create_label(_("Quota:"), table, row);
+ label = libbalsa_create_grid_label(_("Quota:"), grid, row);
/* mailbox closed: no quota available */
if (!libbalsa_mailbox_imap_is_connected(LIBBALSA_MAILBOX_IMAP(mn->mailbox)))
@@ -958,14 +968,14 @@ folder_conf_imap_sub_node(BalsaMailboxNode * mn)
}
}
label = gtk_label_new(quotas);
- gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
- gtk_table_attach(GTK_TABLE(table), label, 1, 2, row, row + 1,
- GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_set_halign(label, GTK_ALIGN_START);
+ gtk_widget_set_hexpand(label, TRUE);
+ gtk_grid_attach(GTK_GRID(grid), label, 1, row, 1, 1);
g_free(quotas);
sdd->mcv = mailbox_conf_view_new(mn->mailbox,
GTK_WINDOW(sdd->dialog),
- table, 5,
+ grid, 5,
G_CALLBACK(set_ok_sensitive));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]