[balsa/gtk3] Port pref manager from GtkTable to GtkGrid
- From: Peter Bloomfield <PeterB src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/gtk3] Port pref manager from GtkTable to GtkGrid
- Date: Thu, 13 Oct 2011 20:24:29 +0000 (UTC)
commit 80eb12f6a689f18861063b860acaad2e0d445c1e
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Thu Oct 13 16:23:48 2011 -0400
Port pref manager from GtkTable to GtkGrid
* src/pref-manager.c (attach_entry), (attach_entry_full),
(attach_information_menu), (attach_label), (checking_group),
(quoted_group), (broken_8bit_codeset_group), (mdn_group),
(word_wrap_group), (other_options_group), (main_window_group),
(display_formats_group), (information_messages_group),
(attach_font_button), (preview_font_group), (create_grid),
(message_window_group): migrate from GtkTable to GtkGrid.
ChangeLog | 10 ++
src/pref-manager.c | 326 +++++++++++++++++++++++-----------------------------
2 files changed, 152 insertions(+), 184 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 2c30dda..c22dac1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2011-10-13 Peter Bloomfield
+
+ * src/pref-manager.c (attach_entry), (attach_entry_full),
+ (attach_information_menu), (attach_label), (checking_group),
+ (quoted_group), (broken_8bit_codeset_group), (mdn_group),
+ (word_wrap_group), (other_options_group), (main_window_group),
+ (display_formats_group), (information_messages_group),
+ (attach_font_button), (preview_font_group), (create_grid),
+ (message_window_group): migrate from GtkTable to GtkGrid.
+
2011-10-06 Peter Bloomfield
* src/main-window.c: migrate from GtkTable to GtkGrid.
diff --git a/src/pref-manager.c b/src/pref-manager.c
index 320118e..21016e0 100644
--- a/src/pref-manager.c
+++ b/src/pref-manager.c
@@ -19,7 +19,7 @@
* 02111-1307, USA.
*/
-/* MAKE SURE YOU USE THE HELPER FUNCTIONS, like create_table(, page), etc. */
+/* MAKE SURE YOU USE THE HELPER FUNCTIONS, like create_grid(etc. */
#if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
# include "config.h"
@@ -72,7 +72,7 @@
#define COL_SPACING (1 * HIG_PADDING)
#define BALSA_PAGE_SIZE_GROUP_KEY "balsa-page-size-group"
-#define BALSA_TABLE_PAGE_KEY "balsa-table-page"
+#define BALSA_GRID_PAGE_KEY "balsa-grid-page"
typedef struct _PropertyUI {
/* The page index: */
GtkWidget *view;
@@ -279,15 +279,15 @@ static GtkWidget *misc_spelling_group(GtkWidget * page);
#endif /* HAVE_GTKSPELL */
/* general helpers */
-static GtkWidget *create_table(gint rows, gint cols, GtkWidget * page);
+static GtkGrid *create_grid(GtkWidget * page);
static GtkWidget *add_pref_menu(const gchar * label, const gchar * names[],
gint size, gint * index, GtkBox * parent,
gint padding, GtkWidget * page);
static void add_show_menu(const char *label, gint level, GtkWidget * menu);
static GtkWidget *attach_entry(const gchar * label, gint row,
- GtkWidget * table);
+ GtkGrid * grid);
static GtkWidget *attach_entry_full(const gchar * label, gint row,
- GtkWidget * table, gint col_left,
+ GtkGrid * grid, gint col_left,
gint col_middle, gint col_right);
static GtkWidget *create_pref_option_menu(const gchar * names[], gint size,
gint * index);
@@ -1477,59 +1477,52 @@ update_mail_servers(void)
/* helper functions that simplify often performed actions */
static GtkWidget *
-attach_entry(const gchar * label, gint row, GtkWidget * table)
+attach_entry(const gchar * label, gint row, GtkGrid * grid)
{
- return attach_entry_full(label, row, table, 0, 1, 2);
+ return attach_entry_full(label, row, grid, 0, 1, 2);
}
static GtkWidget *
-attach_entry_full(const gchar * label, gint row, GtkWidget * table,
+attach_entry_full(const gchar * label, gint row, GtkGrid * grid,
gint col_left, gint col_middle, gint col_right)
{
GtkWidget *res, *lw;
GtkWidget *page;
- res = gtk_entry_new();
lw = gtk_label_new(label);
- gtk_misc_set_alignment(GTK_MISC(lw), 0, 0.5);
- page = g_object_get_data(G_OBJECT(table), BALSA_TABLE_PAGE_KEY);
+ page = g_object_get_data(G_OBJECT(grid), BALSA_GRID_PAGE_KEY);
pm_page_add_to_size_group(page, lw);
- gtk_table_attach(GTK_TABLE(table), lw,
- col_left, col_middle,
- row, row + 1,
- (GtkAttachOptions) (GTK_FILL),
- (GtkAttachOptions) (0), 0, 0);
- gtk_label_set_justify(GTK_LABEL(lw), GTK_JUSTIFY_RIGHT);
-
- gtk_table_attach(GTK_TABLE(table), res,
- col_middle, col_right,
- row, row + 1,
- GTK_EXPAND | GTK_FILL,
- (GtkAttachOptions) (0), 0, 0);
+ gtk_widget_set_halign(lw, GTK_ALIGN_START);
+ gtk_widget_set_hexpand(lw, TRUE);
+ gtk_grid_attach(grid, lw, col_left, row, col_middle - col_left, 1);
+
+ res = gtk_entry_new();
+ gtk_widget_set_hexpand(res, TRUE);
+ gtk_grid_attach(grid, res, col_middle, row, col_right - col_middle, 1);
+
return res;
}
static GtkWidget *
-attach_information_menu(const gchar * label, gint row, GtkTable * table,
+attach_information_menu(const gchar * label, gint row, GtkGrid * grid,
gint defval)
{
GtkWidget *w, *combo_box;
w = gtk_label_new(label);
- gtk_misc_set_alignment(GTK_MISC(w), 0, 0.5);
- gtk_table_attach(GTK_TABLE(table), w, 0, 1, row, row + 1,
- GTK_FILL, 0, 0, 0);
+ gtk_widget_set_halign(w, GTK_ALIGN_START);
+ gtk_grid_attach(grid, w, 0, row, 1, 1);
combo_box = create_information_message_menu();
pm_combo_box_set_level(combo_box, defval);
- gtk_table_attach(GTK_TABLE(table), combo_box, 1, 2, row, row + 1,
- GTK_EXPAND | GTK_FILL, 0, 0, 0);
+ gtk_widget_set_hexpand(combo_box, TRUE);
+ gtk_grid_attach(grid, combo_box, 1, row, 1, 1);
return combo_box;
}
static GtkWidget *
-attach_label(const gchar * text, GtkWidget * table, gint row,
+attach_label(const gchar * text, GtkGrid * grid, gint row,
GtkWidget * page)
{
GtkWidget *label;
@@ -1538,8 +1531,7 @@ attach_label(const gchar * text, GtkWidget * table, gint row,
gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
- gtk_table_attach(GTK_TABLE(table), label, 0, 1, row, row + 1,
- GTK_FILL, 0, 0, 0);
+ gtk_grid_attach(grid, label, 0, row, 1, 1);
if (page)
pm_page_add_to_size_group(page, label);
@@ -1791,45 +1783,41 @@ static GtkWidget *
checking_group(GtkWidget * page)
{
GtkWidget *group;
- GtkWidget *table;
+ GtkGrid *grid;
guint row;
GtkAdjustment *spinbutton_adj;
GtkWidget *label;
GtkWidget *hbox;
group = pm_group_new(_("Checking"));
- table = create_table(6, 3, page);
- pm_group_add(group, table, FALSE);
+ grid = create_grid(page);
+ pm_group_add(group, (GtkWidget *) grid, FALSE);
row = 0;
pui->check_mail_auto = gtk_check_button_new_with_mnemonic(
_("_Check mail automatically every"));
- gtk_table_attach(GTK_TABLE(table), pui->check_mail_auto,
- 0, 1, row, row + 1, GTK_FILL, 0, 0, 0);
+ gtk_grid_attach(grid, pui->check_mail_auto, 0, row, 1, 1);
pm_page_add_to_size_group(page, pui->check_mail_auto);
spinbutton_adj = gtk_adjustment_new(10, 1, 100, 1, 10, 0);
pui->check_mail_minutes = gtk_spin_button_new(spinbutton_adj, 1, 0);
- gtk_table_attach(GTK_TABLE(table), pui->check_mail_minutes,
- 1, 2, row, row + 1, GTK_EXPAND | GTK_FILL, 0, 0, 0);
+ gtk_widget_set_hexpand(pui->check_mail_minutes, TRUE);
+ gtk_grid_attach(grid, pui->check_mail_minutes, 1, row, 1, 1);
label = gtk_label_new(_("minutes"));
- gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
- gtk_table_attach(GTK_TABLE(table), label,
- 2, 3, row, row + 1, GTK_FILL, 0, 0, 0);
+ gtk_widget_set_halign(label, GTK_ALIGN_START);
+ gtk_grid_attach(grid, label, 2, row, 1, 1);
++row;
pui->check_imap = gtk_check_button_new_with_mnemonic(
_("Check _IMAP mailboxes"));
- gtk_table_attach(GTK_TABLE(table), pui->check_imap,
- 0, 1, row, row + 1, GTK_FILL, 0, 0, 0);
+ gtk_grid_attach(grid, pui->check_imap, 0, row, 1, 1);
pm_page_add_to_size_group(page, pui->check_imap);
-
- pui->check_imap_inbox = gtk_check_button_new_with_mnemonic(
- _("Check INBOX _only"));
- gtk_table_attach(GTK_TABLE(table), pui->check_imap_inbox,
- 1, 3, row, row + 1, GTK_FILL, 0, 0, 0);
-
+
+ pui->check_imap_inbox =
+ gtk_check_button_new_with_mnemonic(_("Check INBOX _only"));
+ gtk_grid_attach(grid, pui->check_imap_inbox, 1, row, 2, 1);
+
++row;
hbox = gtk_hbox_new(FALSE, COL_SPACING);
@@ -1852,29 +1840,25 @@ checking_group(GtkWidget * page)
gtk_box_pack_start(GTK_BOX(hbox), pui->notify_new_mail_icon,
FALSE, FALSE, 0);
- gtk_table_attach(GTK_TABLE(table), hbox,
- 0, 3, row, row + 1, GTK_FILL, 0, 0, 0);
-
+ gtk_grid_attach(grid, hbox, 0, row, 3, 1);
+
++row;
pui->quiet_background_check = gtk_check_button_new_with_label(
_("Do background check quietly (no messages in status bar)"));
- gtk_table_attach(GTK_TABLE(table), pui->quiet_background_check,
- 0, 3, row, row + 1, GTK_FILL, 0, 0, 0);
+ gtk_grid_attach(grid, pui->quiet_background_check, 0, row, 3, 1);
++row;
label = gtk_label_new_with_mnemonic(_("_POP message size limit:"));
- gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
- gtk_table_attach(GTK_TABLE(table), label,
- 0, 1, row, row + 1, GTK_FILL, 0, 0, 0);
+ gtk_widget_set_halign(label, GTK_ALIGN_START);
+ gtk_grid_attach(grid, label, 0, row, 1, 1);
pui->msg_size_limit = gtk_spin_button_new_with_range(0.1, 100, 0.1);
gtk_label_set_mnemonic_widget(GTK_LABEL(label), pui->msg_size_limit);
- gtk_table_attach(GTK_TABLE(table), pui->msg_size_limit,
- 1, 2, row, row + 1, GTK_EXPAND | GTK_FILL, 0, 0, 0);
+ gtk_widget_set_hexpand(pui->msg_size_limit, TRUE);
+ gtk_grid_attach(grid, pui->msg_size_limit, 1, row, 1, 1);
label = gtk_label_new(_("MB"));
- gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
- gtk_table_attach(GTK_TABLE(table), label,
- 2, 3, row, row + 1, GTK_FILL, 0, 0, 0);
-
+ gtk_widget_set_halign(label, GTK_ALIGN_START);
+ gtk_grid_attach(grid, label, 2, row, 1, 1);
+
return group;
}
@@ -1882,7 +1866,7 @@ static GtkWidget *
quoted_group(GtkWidget * page)
{
GtkWidget *group;
- GtkWidget *table;
+ GtkGrid *grid;
GtkAdjustment *spinbutton_adj;
GtkWidget *label;
guint row = 0;
@@ -1891,38 +1875,34 @@ quoted_group(GtkWidget * page)
/* and RFC2646-style flowed text */
group = pm_group_new(_("Quoted and flowed text"));
- table = create_table(3, 3, page);
- pm_group_add(group, table, FALSE);
+ grid = create_grid(page);
+ pm_group_add(group, (GtkWidget *) grid, FALSE);
pui->mark_quoted =
gtk_check_button_new_with_label(_("Mark quoted text"));
- gtk_table_attach(GTK_TABLE(table), pui->mark_quoted,
- 0, 2, row, row + 1, GTK_FILL, 0, 0, 0);
+ gtk_grid_attach(grid, pui->mark_quoted, 0, row, 2, 1);
++row;
- attach_label(_("Quoted text regular expression:"), table, row, page);
+ attach_label(_("Quoted text regular expression:"), grid, row, page);
pui->quote_pattern = gtk_entry_new();
- gtk_table_attach(GTK_TABLE(table), pui->quote_pattern,
- 1, 3, row, row + 1,
- GTK_EXPAND | GTK_FILL, 0, 0, 0);
+ gtk_widget_set_hexpand(pui->quote_pattern, TRUE);
+ gtk_grid_attach(grid, pui->quote_pattern, 1, row, 2, 1);
++row;
pui->browse_wrap =
gtk_check_button_new_with_label(_("Wrap text at"));
- gtk_table_attach(GTK_TABLE(table), pui->browse_wrap,
- 0, 1, row, row + 1, GTK_FILL, 0, 0, 0);
+ gtk_grid_attach(grid, pui->browse_wrap, 0, row, 1, 1);
pm_page_add_to_size_group(page, pui->browse_wrap);
spinbutton_adj = gtk_adjustment_new(1.0, 40.0, 200.0, 1.0, 5.0, 0.0);
pui->browse_wrap_length = gtk_spin_button_new(spinbutton_adj, 1, 0);
- gtk_table_attach(GTK_TABLE(table), pui->browse_wrap_length,
- 1, 2, row, row + 1,
- GTK_EXPAND | GTK_FILL, 0, 0, 0);
+ gtk_widget_set_hexpand(pui->browse_wrap_length, TRUE);
+ gtk_grid_attach(grid, pui->browse_wrap_length, 1, row, 1, 1);
label = gtk_label_new(_("characters"));
gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
- gtk_table_attach(GTK_TABLE(table), label, 2, 3, row, row + 1,
- GTK_FILL, 0, 0, 0);
+ gtk_widget_set_halign(label, GTK_ALIGN_START);
+ gtk_grid_attach(grid, label, 2, row, 1, 1);
return group;
}
@@ -1947,7 +1927,7 @@ static GtkWidget *
broken_8bit_codeset_group(GtkWidget * page)
{
GtkWidget *group;
- GtkWidget *table;
+ GtkGrid *grid;
GSList *radio_group = NULL;
/* treatment of messages with 8-bit chars, but without proper MIME encoding */
@@ -1955,37 +1935,34 @@ broken_8bit_codeset_group(GtkWidget * page)
group =
pm_group_new(_("National (8-bit) characters in broken messages "
"without codeset header"));
- table = create_table(2, 2, page);
- pm_group_add(group, table, FALSE);
-
+ grid = create_grid(page);
+ pm_group_add(group, (GtkWidget *) grid, FALSE);
+
pui->convert_unknown_8bit[0] =
GTK_RADIO_BUTTON(gtk_radio_button_new_with_label(radio_group,
_("display as \"?\"")));
- gtk_table_attach(GTK_TABLE(table), GTK_WIDGET(pui->convert_unknown_8bit[0]),
- 0, 2, 0, 1,
- (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
- radio_group =
+ gtk_grid_attach(grid, GTK_WIDGET(pui->convert_unknown_8bit[0]),
+ 0, 0, 2, 1);
+ radio_group =
gtk_radio_button_get_group(GTK_RADIO_BUTTON(pui->convert_unknown_8bit[0]));
-
+
pui->convert_unknown_8bit[1] =
GTK_RADIO_BUTTON(gtk_radio_button_new_with_label(radio_group,
_("display in codeset")));
- gtk_table_attach(GTK_TABLE(table), GTK_WIDGET(pui->convert_unknown_8bit[1]),
- 0, 1, 1, 2,
- (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
-
+ gtk_grid_attach(grid, GTK_WIDGET(pui->convert_unknown_8bit[1]),
+ 0, 1, 1, 1);
+
pui->convert_unknown_8bit_codeset = libbalsa_charset_button_new();
gtk_combo_box_set_active(GTK_COMBO_BOX
(pui->convert_unknown_8bit_codeset),
balsa_app.convert_unknown_8bit_codeset);
- gtk_table_attach(GTK_TABLE(table), pui->convert_unknown_8bit_codeset,
- 1, 2, 1, 2,
- GTK_EXPAND | GTK_FILL,
- (GtkAttachOptions) (0), 0, 0);
+ gtk_widget_set_hexpand(pui->convert_unknown_8bit_codeset, TRUE);
+ gtk_grid_attach(grid, pui->convert_unknown_8bit_codeset,
+ 1, 1, 1, 1);
pm_page_add_to_size_group(page,
GTK_WIDGET(pui->convert_unknown_8bit[1]));
-
+
return group;
}
@@ -1995,7 +1972,7 @@ mdn_group(GtkWidget * page)
{
GtkWidget *group;
GtkWidget *label;
- GtkWidget *table;
+ GtkGrid *grid;
/* How to handle received MDN requests */
@@ -2010,40 +1987,30 @@ mdn_group(GtkWidget * page)
gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
pm_group_add(group, label, FALSE);
- table = create_table(2, 2, page);
- pm_group_add(group, table, FALSE);
+ grid = create_grid(page);
+ pm_group_add(group, (GtkWidget *) grid, FALSE);
label = gtk_label_new(_("The message header looks clean "
"(the notify-to address is the return path, "
"and I am in the \"To:\" or \"Cc:\" list)."));
- gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
- gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
- gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1,
- GTK_FILL, 0, 0, 0);
+ gtk_grid_attach(grid, label, 0, 0, 1, 1);
pm_page_add_to_size_group(page, label);
pui->mdn_reply_clean_menu = create_mdn_reply_menu();
pm_combo_box_set_level(pui->mdn_reply_clean_menu,
balsa_app.mdn_reply_clean);
- gtk_table_attach(GTK_TABLE(table), pui->mdn_reply_clean_menu,
- 1, 2, 0, 1,
- GTK_EXPAND | GTK_FILL, 0, 0, 0);
+ gtk_grid_attach(grid, pui->mdn_reply_clean_menu, 1, 0, 1, 1);
label = gtk_label_new(_("The message header looks suspicious."));
- gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
- gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
- gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2,
- GTK_FILL, (GtkAttachOptions) (0), 0, 0);
+ gtk_grid_attach(grid, label, 0, 1, 1, 1);
pm_page_add_to_size_group(page, label);
pui->mdn_reply_notclean_menu = create_mdn_reply_menu();
pm_combo_box_set_level(pui->mdn_reply_notclean_menu,
balsa_app.mdn_reply_notclean);
- gtk_table_attach(GTK_TABLE(table), pui->mdn_reply_notclean_menu,
- 1, 2, 1, 2,
- GTK_EXPAND | GTK_FILL, 0, 0, 0);
+ gtk_grid_attach(grid, pui->mdn_reply_notclean_menu, 1, 1, 1, 1);
return group;
}
@@ -2063,31 +2030,28 @@ static GtkWidget *
word_wrap_group(GtkWidget * page)
{
GtkWidget *group;
- GtkWidget *table;
+ GtkGrid *grid;
GtkAdjustment *spinbutton_adj;
GtkWidget *label;
group = pm_group_new(_("Word wrap"));
- table = create_table(1, 3, page);
- pm_group_add(group, table, FALSE);
+ grid = create_grid(page);
+ pm_group_add(group, (GtkWidget *) grid, FALSE);
pui->wordwrap =
gtk_check_button_new_with_label(_("Wrap outgoing text at"));
- gtk_table_attach(GTK_TABLE(table), pui->wordwrap, 0, 1, 0, 1,
- (GtkAttachOptions) (GTK_FILL),
- (GtkAttachOptions) (0), 0, 0);
+ gtk_grid_attach(grid, pui->wordwrap, 0, 0, 1, 1);
pm_page_add_to_size_group(page, pui->wordwrap);
spinbutton_adj = gtk_adjustment_new(1.0, 40.0, 998.0, 1.0, 5.0, 0.0);
pui->wraplength = gtk_spin_button_new(spinbutton_adj, 1, 0);
- gtk_table_attach(GTK_TABLE(table), pui->wraplength, 1, 2, 0, 1,
- GTK_EXPAND | GTK_FILL, (GtkAttachOptions) (0), 0, 0);
+ gtk_widget_set_hexpand(pui->wraplength, TRUE);
+ gtk_grid_attach(grid, pui->wraplength, 1, 0, 1, 1);
gtk_widget_set_sensitive(pui->wraplength, FALSE);
label = gtk_label_new(_("characters"));
- gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
- gtk_table_attach(GTK_TABLE(table), label, 2, 3, 0, 1,
- GTK_FILL, (GtkAttachOptions) (0), 0, 0);
+ gtk_widget_set_halign(label, GTK_ALIGN_START);
+ gtk_grid_attach(grid, label, 2, 0, 1, 1);
return group;
}
@@ -2096,14 +2060,14 @@ static GtkWidget *
other_options_group(GtkWidget * page)
{
GtkWidget *group;
- GtkWidget *table;
+ GtkGrid *grid;
group = pm_group_new(_("Other options"));
- table = create_table(1, 2, page);
- pm_group_add(group, table, FALSE);
+ grid = (GtkGrid *) create_grid(page);
+ pm_group_add(group, (GtkWidget *) grid, FALSE);
- pui->quote_str = attach_entry(_("Reply prefix:"), 0, table);
+ pui->quote_str = attach_entry(_("Reply prefix:"), 0, grid);
pui->autoquote =
pm_group_add_check(group, _("Automatically quote original "
@@ -2167,7 +2131,7 @@ static GtkWidget *
main_window_group(GtkWidget * page)
{
GtkWidget *group;
- GtkWidget *table;
+ GtkGrid *grid;
GtkAdjustment *scroll_adj;
GtkWidget *label;
@@ -2186,23 +2150,20 @@ main_window_group(GtkWidget * page)
pm_group_add_check(group, _("Ask me before selecting a different "
"mailbox to show an unread message"));
- table = create_table(1, 3, page);
- pm_group_add(group, table, FALSE);
+ grid = create_grid(page);
+ pm_group_add(group, (GtkWidget *) grid, FALSE);
pui->pgdownmod =
gtk_check_button_new_with_label(_("PageUp/PageDown keys "
"scroll text by"));
- gtk_table_attach(GTK_TABLE(table), pui->pgdownmod, 0, 1, 0, 1,
- (GtkAttachOptions) (GTK_FILL),
- (GtkAttachOptions) (0), 0, 0);
+ gtk_grid_attach(grid, pui->pgdownmod, 0, 0, 1, 1);
scroll_adj = gtk_adjustment_new(50.0, 10.0, 100.0, 5.0, 10.0, 0.0);
pui->pgdown_percent = gtk_spin_button_new(scroll_adj, 1, 0);
gtk_widget_set_sensitive(pui->pgdown_percent, FALSE);
- gtk_table_attach(GTK_TABLE(table), pui->pgdown_percent, 1, 2, 0, 1,
- GTK_EXPAND | GTK_FILL, (GtkAttachOptions) (0), 0, 0);
+ gtk_widget_set_hexpand(pui->pgdown_percent, TRUE);
+ gtk_grid_attach(grid, pui->pgdown_percent, 1, 0, 1, 1);
label = gtk_label_new(_("percent"));
gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
- gtk_table_attach(GTK_TABLE(table), label, 2, 3, 0, 1,
- GTK_FILL, (GtkAttachOptions) (0), 0, 0);
+ gtk_grid_attach(grid, label, 2, 0, 1, 1);
return group;
}
@@ -2232,16 +2193,16 @@ static GtkWidget *
display_formats_group(GtkWidget * page)
{
GtkWidget *group;
- GtkWidget *table;
+ GtkGrid *grid;
group = pm_group_new(_("Format"));
- table = create_table(2, 2, page);
- pm_group_add(group, table, FALSE);
-
+ grid = create_grid(page);
+ pm_group_add(group, (GtkWidget *) grid, FALSE);
+
pui->date_format =
- attach_entry(_("Date encoding (for strftime):"), 0, table);
+ attach_entry(_("Date encoding (for strftime):"), 0, grid);
pui->selected_headers =
- attach_entry(_("Selected headers:"), 1, table);
+ attach_entry(_("Selected headers:"), 1, grid);
return group;
}
@@ -2261,31 +2222,31 @@ static GtkWidget *
information_messages_group(GtkWidget * page)
{
GtkWidget *group;
- GtkWidget *table;
+ GtkGrid *grid;
group = pm_group_new(_("Information messages"));
- table = create_table(5, 2, page);
- pm_group_add(group, table, FALSE);
+ grid = (GtkGrid *) create_grid(page);
+ pm_group_add(group, (GtkWidget *) grid, FALSE);
pui->information_message_menu =
attach_information_menu(_("Information messages:"), 0,
- GTK_TABLE(table),
+ grid,
balsa_app.information_message);
pui->warning_message_menu =
attach_information_menu(_("Warning messages:"), 1,
- GTK_TABLE(table),
+ grid,
balsa_app.warning_message);
pui->error_message_menu =
attach_information_menu(_("Error messages:"), 2,
- GTK_TABLE(table),
+ grid,
balsa_app.error_message);
pui->fatal_message_menu =
attach_information_menu(_("Fatal error messages:"), 3,
- GTK_TABLE(table),
+ grid,
balsa_app.fatal_message);
pui->debug_message_menu =
attach_information_menu(_("Debug messages:"), 4,
- GTK_TABLE(table),
+ grid,
balsa_app.debug_message);
return group;
@@ -2386,16 +2347,15 @@ font_button_check_font_size(GtkWidget * button, GtkWidget * widget)
* the string does not specify a point size.
*/
static gboolean
-attach_font_button(const gchar * label, gint row, GtkWidget * table,
+attach_font_button(const gchar * label, gint row, GtkGrid * grid,
GtkWidget * page, const gchar * font,
GtkWidget ** button)
{
- attach_label(label, table, row, page);
+ attach_label(label, grid, row, page);
*button = gtk_font_button_new_with_font(font);
- gtk_table_attach(GTK_TABLE(table), *button,
- 1, 2, row, row + 1,
- GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_set_hexpand(*button, TRUE);
+ gtk_grid_attach(grid, *button, 1, row, 1, 1);
return font_button_check_font_size(*button, page);
}
@@ -2412,28 +2372,28 @@ static GtkWidget *
preview_font_group(GtkWidget * page)
{
GtkWidget *group;
- GtkWidget *table;
+ GtkGrid *grid;
gboolean use_default_font_size = FALSE;
group = pm_group_new(_("Fonts"));
- table = create_table(3, 2, page);
- pm_group_add(group, table, FALSE);
+ grid = (GtkGrid *) create_grid(page);
+ pm_group_add(group, (GtkWidget *) grid, FALSE);
- if (attach_font_button(_("Message font:"), 0, table, page,
+ if (attach_font_button(_("Message font:"), 0, grid, page,
balsa_app.message_font,
&pui->message_font_button))
use_default_font_size = TRUE;
- if (attach_font_button(_("Subject font:"), 1, table, page,
+ if (attach_font_button(_("Subject font:"), 1, grid, page,
balsa_app.subject_font,
&pui->subject_font_button))
use_default_font_size = TRUE;
pui->use_default_font_size =
gtk_check_button_new_with_label(_("Use default font size"));
- gtk_table_attach(GTK_TABLE(table), pui->use_default_font_size,
- 0, 2, 2, 3,
- GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_set_hexpand(pui->use_default_font_size, TRUE);
+ gtk_grid_attach(grid, pui->use_default_font_size,
+ 0, 2, 2, 1);
if (use_default_font_size) {
gtk_font_button_set_show_size(GTK_FONT_BUTTON
@@ -2515,17 +2475,17 @@ add_pref_menu(const gchar* label, const gchar *names[], gint size,
return omenu;
}
-static GtkWidget *
-create_table(gint rows, gint cols, GtkWidget * page)
+static GtkGrid *
+create_grid(GtkWidget * page)
{
- GtkWidget *table;
+ GtkGrid *grid;
- table = gtk_table_new(rows, cols, FALSE);
- gtk_table_set_row_spacings(GTK_TABLE(table), ROW_SPACING);
- gtk_table_set_col_spacings(GTK_TABLE(table), COL_SPACING);
- g_object_set_data(G_OBJECT(table), BALSA_TABLE_PAGE_KEY, page);
+ grid = (GtkGrid *) gtk_grid_new();
+ gtk_grid_set_row_spacing(grid, ROW_SPACING);
+ gtk_grid_set_column_spacing(grid, COL_SPACING);
+ g_object_set_data(G_OBJECT(grid), BALSA_GRID_PAGE_KEY, page);
- return table;
+ return grid;
}
#if !HAVE_GTKSPELL
@@ -2664,22 +2624,20 @@ static GtkWidget *
message_window_group(GtkWidget * page)
{
GtkWidget *group;
- GtkWidget *table;
+ GtkGrid *grid;
group = pm_group_new(_("Message window"));
- table = create_table(1, 2, page);
- pm_group_add(group, table, FALSE);
+ grid = create_grid(page);
+ pm_group_add(group, (GtkWidget *) grid, FALSE);
- attach_label(_("After moving a message:"), table, 0, NULL);
+ attach_label(_("After moving a message:"), grid, 0, NULL);
pui->action_after_move_menu = create_action_after_move_menu();
pm_combo_box_set_level(pui->action_after_move_menu,
balsa_app.mw_action_after_move);
- gtk_table_attach(GTK_TABLE(table), pui->action_after_move_menu,
- 1, 2, 0, 1,
- GTK_EXPAND | GTK_FILL,
- (GtkAttachOptions) (0), 0, 0);
+ gtk_widget_set_hexpand(pui->action_after_move_menu, TRUE);
+ gtk_grid_attach(grid, pui->action_after_move_menu, 1, 0, 1, 1);
return group;
}
@@ -3499,7 +3457,7 @@ balsa_help_pbox_display(void)
* size, to line up the second widget in each row
*
* because we use size-groups to align widgets, we could pack each row
- * in an hbox instead of using tables, but the tables are convenient
+ * in an hbox instead of using grids, but the grids are convenient
*/
static GtkWidget *
pm_page_new(void)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]